Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
change value while debugging
Is there any way to change a value of a variable whilst in the debugger.
The initialisation of a variable was in the wrong place so the macro stopped. I know what it should have been, and I have now corrected the code, but I also have to repair the spreadsheet, it would have been so much easier if I could have changed the value and then continued to run the rest of the code. Is this possible? (XL2003) and how do I do it? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
change value while debugging
Graham,
When you stop, go to the line below the highlighted line, and enter a new line of code myStrVariable = "NewValue" or myIntVariable = 3 as appropriate, then step through using F8, and comment out your new line after you have executed it. HTH, Bernie MS Excel MVP "Graham Y" wrote in message ... Is there any way to change a value of a variable whilst in the debugger. The initialisation of a variable was in the wrong place so the macro stopped. I know what it should have been, and I have now corrected the code, but I also have to repair the spreadsheet, it would have been so much easier if I could have changed the value and then continued to run the rest of the code. Is this possible? (XL2003) and how do I do it? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
change value while debugging
Bernie
Clever, but, I couldn't get past the line as it was a cell coordinate of 0, it's a shame the current cell isn't Cells(0,0) ! Thanks I shall remember the tip for future reference. "Bernie Deitrick" wrote: Graham, When you stop, go to the line below the highlighted line, and enter a new line of code myStrVariable = "NewValue" or myIntVariable = 3 as appropriate, then step through using F8, and comment out your new line after you have executed it. HTH, Bernie MS Excel MVP "Graham Y" wrote in message ... Is there any way to change a value of a variable whilst in the debugger. The initialisation of a variable was in the wrong place so the macro stopped. I know what it should have been, and I have now corrected the code, but I also have to repair the spreadsheet, it would have been so much easier if I could have changed the value and then continued to run the rest of the code. Is this possible? (XL2003) and how do I do it? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
change value while debugging
Graham,
Temporarily overwrite the variable in the highlighted code with a constant - the debugger may or may not allow you to get away with it.... HTH, Bernie MS Excel MVP "Graham Y" wrote in message ... Bernie Clever, but, I couldn't get past the line as it was a cell coordinate of 0, it's a shame the current cell isn't Cells(0,0) ! Thanks I shall remember the tip for future reference. "Bernie Deitrick" wrote: Graham, When you stop, go to the line below the highlighted line, and enter a new line of code myStrVariable = "NewValue" or myIntVariable = 3 as appropriate, then step through using F8, and comment out your new line after you have executed it. HTH, Bernie MS Excel MVP "Graham Y" wrote in message ... Is there any way to change a value of a variable whilst in the debugger. The initialisation of a variable was in the wrong place so the macro stopped. I know what it should have been, and I have now corrected the code, but I also have to repair the spreadsheet, it would have been so much easier if I could have changed the value and then continued to run the rest of the code. Is this possible? (XL2003) and how do I do it? |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
change value while debugging
I'm pretty sure the answer is "no", you can't change the value of a
variable in the debugger. I have gotten into the habit of saving my files before running untested code- if there is a catastrophic failure I can close the file without saving to revert to the earlier version. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help debugging a VLOOKUP and MATCH combo | Excel Worksheet Functions | |||
Need some debugging help, please | Excel Discussion (Misc queries) | |||
Excel VBA debugging help needed! | Excel Discussion (Misc queries) | |||
Help Spreadsheet1.ActiveSheet.Range("B1").LoadText debugging | Charts and Charting in Excel | |||
Startup Error debugging help | Excel Discussion (Misc queries) |