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.
upobDaPlayaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

[ fanpages ]IT Services ConsultantCommented:
This code loops through rows 1 to 1000, setting the active (visible) cell to column [A] of the sequential row...

Public Sub Q_28701027()

  Dim lngRow                                            As Long
  
  For lngRow = 1& To 1000&
  
      DoEvents
      
      Application.Goto Reference:=Cells(lngRow, 1), Scroll:=True
      
  Next lngRow
  
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michael FowlerSolutions ConsultantCommented:
Use something like this. Just replace the Range("A100") with the values in your counter

Application.Goto Range("A100"), True 

Open in new window

0
Martin LissOlder than dirtCommented:
If fanpages' code doesn't do what you want then please attach your workbook or a facsimile.
0
[ fanpages ]IT Services ConsultantCommented:
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

0
upobDaPlayaAuthor Commented:
Thx..Fanpage solution worked...Michael than you for the suggestion..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.