Assign a variable a value while in Debug

OldSwimmer1650

New Member
Joined
Dec 3, 2020
Messages
38
Office Version
  1. 365
Platform
  1. Windows
Is it possible to change a variable value while in debug. Say x=4 but I want to change it to x=45 while stepping through (F8) the code to see how to code performs?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Yes, just set x=45 in the Immediate Window.

If you can't see this in the VB Editor, just select View/Immediate Window, or Ctrl+G.
 
Upvote 0
I am reading it slightly differently. If you haven't executed the line x=4 yet then you can change it in the code to a different number and continue to step through it.
If you have executed that line you can drag the yellow arrow back up to that line and change the value then hit F8 to step through it.
 
Upvote 0

Forum statistics

Threads
1,221,621
Messages
6,160,880
Members
451,676
Latest member
Assy Bissy

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