worksheet delete resets global vba variables !!

stevebovy

New Member
Joined
Jun 16, 2008
Messages
18
When I try to delete a sheet, my global varibles go POOF !!!

dim wksheet as worksheet

for each wksheet in worksheets


if ******** then
wksheet.delete
end if

next


or


set wksheet = Activesheet

wksheet.delete


after either of the above all my global vars are destroyed and
any classes of course also go byby

Help me obi wan kanobi !!!!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Welcome to the Board!

Is there any way you can just store these variables to a hidden sheet or a worksheet that is not deleted? Then you don't have to worry about the global variables resetting? Its just one idea.
 
Upvote 0
Thanks, I have done that partially already, but I also have a class for capturing application events. And when the stupid reset occurs I lose
my application event handling class

Any one out there have any ideas on what is causing the reset ???

Any one else experience this problem ???
 
Upvote 0
FYI: The reset occurs AFTER the function with the wksheet.delete
exits and goes out of scope.

this is very weird and nasty bugginess !!!
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,767
Members
449,049
Latest member
greyangel23

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