Showing the same line when going to another sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I see sheet 1 in excel, and I scroll down so that I see for example row
35, I want to see the same row (row 35 in this example) when I go to sheet 2
(or another screen).

How can I do this,
Can Anyone help me out?
 
Giebel, this is kind of crude because there is a brief delay and the screen
flickers a bit when you switch to Sheet2. However, if no one else has a
better solution, then maybe this will be helpful. Display Sheet2,
right-click on the sheet's tab, select View Code, and paste this code in
there. James

Private Sub Worksheet_Activate()
Dim sr As Long, sc As Integer
Application.ScreenUpdating = False
ThisWorkbook.Sheets("Sheet1").Select
sr = ActiveWindow.ScrollRow
sc = ActiveWindow.ScrollColumn
ThisWorkbook.Worksheets("Sheet2").Activate
With ActiveWindow
.ScrollRow = sr
.ScrollColumn = sc
End With
Application.ScreenUpdating = True
End Sub
 
I forgot to disable events in the other code. This will work better. Put
in Sheet2's code page. James

Private Sub Worksheet_Activate()
Dim sr As Long, sc As Integer
Application.EnableEvents = False
Application.ScreenUpdating = False
ThisWorkbook.Sheets("Sheet1").Select
sr = ActiveWindow.ScrollRow
sc = ActiveWindow.ScrollColumn
ThisWorkbook.Worksheets("Sheet2").Activate
With ActiveWindow
.ScrollRow = sr
.ScrollColumn = sc
End With
Application.ScreenUpdating = True
Application.EnableEvents = True
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

Back
Top