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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
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,045
Messages
6,122,830
Members
449,096
Latest member
Erald

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