ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Showing the same line when going to another sheet (https://www.excelbanter.com/excel-programming/401345-showing-same-line-when-going-another-sheet.html)

giebel

Showing the same line when going to another sheet
 
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?

Zone[_3_]

Showing the same line when going to another sheet
 
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


"giebel" wrote in message
...
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?




Zone[_3_]

Showing the same line when going to another sheet
 
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

"Zone" wrote in message
...
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


"giebel" wrote in message
...
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?







All times are GMT +1. The time now is 05:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com