displaying specific rows on screen

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?
 
J

Jim Thomlinson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top