Link to home
Start Free TrialLog in
Avatar of upobDaPlaya
upobDaPlaya

asked on

Need to page down in a MS Excel VBA module once I get to approximately row 46

I have a VBA modules that loops that thru each row in an Excel 2007 spreadsheet.  I make the spreadsheet visible to the user as it loops thru each row.  My dilemma is that once it gets to row 46 approximately the module continues to loop as expected, but visually the focus remains on row 46 and the user can not see the updates as they occur beyond row 46.

What is the code required so that the focus is in synch with the loop.  Thus if the loop is on row 56 the user should be viewing row 56.
ASKER CERTIFIED SOLUTION
Avatar of [ fanpages ]
[ fanpages ]

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If fanpages' code doesn't do what you want then please attach your workbook or a facsimile.
Avatar of [ fanpages ]
[ fanpages ]

Alternatively, if you wish the worksheet to scroll every 46 rows processed...

Public Sub Q_28701027()

  Dim lngRow                                            As Long
  
  For lngRow = 1& To 1000&
  
      DoEvents
      
      If lngRow Mod 46& = 0 Then
         Application.Goto Reference:=Cells(lngRow, 1), Scroll:=True
      End If
      
      Cells(lngRow, 1) = lngRow * Rnd() <- Setting value of column [A] on each row for a demonstration
      
  Next lngRow
  
End Sub

Open in new window

Avatar of upobDaPlaya

ASKER

Thx..Fanpage solution worked...Michael than you for the suggestion..