displaying specific rows on screen

  • Thread starter Thread starter johnsail
  • Start date Start date
J

johnsail

Hi
I would like to control which lines are displayed on screen.
For example:- when user gets down to line 35 I would like to display form
line 20 onwards. When user gets to line 55 display from line 45 onwards.

I can get the screen to move by using:-

If Target.Row = 35 Then
Worksheets("Expense Sheet").Activate
ActiveWindow.ScrollRow = 20
End If

However when the user moves to line 36 the screen reverts back to displaying
from row 1 onwards.

If I test for Target.Row > 34 the screen blinks /flashed every time this
partt of the macro runs.

How do I get the screen to display from row 20 and stay like that until
another ScrollRow tells it to display from row 45 onwards . . . . and so on?
 
Not 100% sure exactly how you want it to work but this might be it...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Row
Case Is > 55
ActiveWindow.ScrollRow = 45
Case Is > 35
ActiveWindow.ScrollRow = 20
End Select
End Sub
 
Back
Top