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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,941
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

stevebovy

New Member
Joined
Jun 16, 2008
Messages
18
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

stevebovy

New Member
Joined
Jun 16, 2008
Messages
18
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,191,190
Messages
5,985,202
Members
439,947
Latest member
fabiannic

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
Top