Worksheet Object Is Nothing Immediately After Adding the Worksheet

wsnyder

Board Regular
Joined
Sep 23, 2018
Messages
223
Office Version
  1. 365
Platform
  1. Windows
Hi all

Using Excel 365.
In my VBA Code, I added a worksheet and gave it a name.
I reviewed the workbook, I see that the worksheet was added and named as expected

I then tried creating a worksheet object based on the new worksheet, but the worksheet object is not being created

The code to add the worksheet object comes immediately after adding the worksheet.
VBA Code:
    'Step 1 (New worksheet name is ListDates)
        GetNewWorksheet wb:=mywb                                                                  
        
    'Step 2 (Add a worksheet object based on the newly added worksheet)
        Set wsListDates = mywb.Worksheets("ListDates")

These are all temporary steps to create a report, when all is done, I do not want to save any of these temporary steps, just the final output report.

Thanks,
-w
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi,​
no such issue on my side so I guess as usual it's an error on the workbook object or on the worksheet name …​
 
Upvote 0
You didn't provide the code of the GetNewWorksheet procedure, so we can't tell what's going on.
 
Upvote 0

Forum statistics

Threads
1,215,553
Messages
6,125,483
Members
449,233
Latest member
Deardevil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top