Reset not working in vba editor in excel

blueflash

New Member
Joined
May 23, 2012
Messages
37
I am using vba in excel 2016 on a mac.
I am making some additions to some code that has worked before.
When I stop the code mid-execution in the editor, or when the code stops due to errors, I stop the code, correct the problems and press the reset button. When I rerun the code, it is obvious that not all variables have been reset.
I have to press the reset button from 6-12 times before all the variables are reset.
Is there another method to reset all variables to the values they should have at the start of the program?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
We would need to see your code before hazarding any guesses.
 
Upvote 0
Pressing the vbe reset button should reset all your variables as long as the relevant vbproject is currently the active vbproject in the vbe.
 
Upvote 0
I cannot post the code as it is too long and complex and the problem occurs in several parts of the code.
However, one instance is when I use breakpoints and stop execution to make changes. After I make the changes, I stop execution by pressing the Reset button. About 8 times out of 10, when I start again and I stop execution to check variable values, I find that in a loop like
for i=var1 to var2
the value for var1 contains a value that is incorrect - I cannot determine where the value of var comes from. The value there causes the loop to fail.
If I press reset enough times and keep rerunning the program, eventually it runs from start to finish without any problems.
Instead of running the program again, if I save everything and close the workbook, it runs perfectly when I reopen the work book.
So I am hoping for an alternative to closing and opening the workbook.
 
Upvote 0

Forum statistics

Threads
1,215,088
Messages
6,123,057
Members
449,091
Latest member
ikke

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