2016-08-03 26 views
0

我正在做我的计算和使用vba,但是当我运行代码时,我看不到发生了什么让我们说在行400中,直到运行结束。显示vba中的活动行移动页面

我发现这个代码:

ActiveWindow.ScrollRow = Selection.Row 
ActiveWindow.ScrollColumn = Selection.Column 

Application. Goto ActiveCell.EntireRow,True 

但它并没有帮助。你能帮我滚动页面并在代码运行时显示活动行吗?

+3

尝试增加'DoEvents'的转到后 –

回答

1

下面尝试它会自动移动到活动单元格

Sub test() 
    Dim i as Long  
    For i = 1 To 1000 
     Range("A" & i).Select 
    Next 
End Sub 
0

你想要转到400行吗?

Application.Goto Rows(400) 

如果要暂停执行,你可以使用StopDebug.Assert False

 

For i = 0 to to lastRow 

    If i = 400 then 
     Application.Goto Rows(400) 
     Stop 
    End IF 

Next 

如果你想暂停宏是一个条件为真,则使用Debug.Assert False。注意:当条件为false时,Debug.Assert会暂停代码。

 

For i = 0 to to lastRow 

    Debug.Assert i <> 400 

Next