Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 66
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 66
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help debugging a VLOOKUP and MATCH combo Zilla[_2_] Excel Worksheet Functions 2 March 18th 07 06:11 PM
Need some debugging help, please [email protected] Excel Discussion (Misc queries) 2 August 8th 06 06:27 PM
Excel VBA debugging help needed! mainemike Excel Discussion (Misc queries) 4 February 22nd 06 12:42 PM
Help Spreadsheet1.ActiveSheet.Range("B1").LoadText debugging qa4ever Charts and Charting in Excel 0 January 2nd 06 09:52 PM
Startup Error debugging help Ron Rosenfeld Excel Discussion (Misc queries) 2 February 3rd 05 08:29 PM


All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"