ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Stepping (https://www.excelbanter.com/excel-programming/365169-macro-stepping.html)

George[_31_]

Macro Stepping
 
When stepping through a macro where values are being changed ( e.g.as in a
loop) is it possible to "see" the current values.

For Example :-

For x= 1 to 19
For y = x+1 to 20
If Cells(x,2) = Cells (y,2) Then ' do something'
next y
next x

I would like to be able to see the values of x & y in the VBA pane as I step
through th macro.

Reagrds
George




Norman Jones

Macro Stepping
 
Hi George,

Try using the Locals Window to see all variables. Alternatively, open the
Watch Window and add thr required variables or expressions.

Either window may be opened from the View menu.


---
Regards,
Norman


"George" wrote in message
...
When stepping through a macro where values are being changed ( e.g.as in a
loop) is it possible to "see" the current values.

For Example :-

For x= 1 to 19
For y = x+1 to 20
If Cells(x,2) = Cells (y,2) Then ' do something'
next y
next x

I would like to be able to see the values of x & y in the VBA pane as I
step through th macro.

Reagrds
George






Andrew Taylor

Macro Stepping
 
If you hover your mouse pointer over the variable name you'll see the
value displayed.



George wrote:
When stepping through a macro where values are being changed ( e.g.as in a
loop) is it possible to "see" the current values.

For Example :-

For x= 1 to 19
For y = x+1 to 20
If Cells(x,2) = Cells (y,2) Then ' do something'
next y
next x

I would like to be able to see the values of x & y in the VBA pane as I step
through th macro.

Reagrds
George



NickHK

Macro Stepping
 
George,
As well as the other replies, you can print to the Immediate window. e.g.
Debug.Print "x=" & x, "y= & y

NickHK

"George" wrote in message
...
When stepping through a macro where values are being changed ( e.g.as in a
loop) is it possible to "see" the current values.

For Example :-

For x= 1 to 19
For y = x+1 to 20
If Cells(x,2) = Cells (y,2) Then ' do something'
next y
next x

I would like to be able to see the values of x & y in the VBA pane as I

step
through th macro.

Reagrds
George







All times are GMT +1. The time now is 04:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com