Hi all,
Is there a VBA code to have Excel scroll simultaneously among different sheets (not all sheets, only specific ones)? I would need something like the below but without having ALL sheets move their position...
Sub SynchSheets()
' Duplicates the active sheet's cell position in each sheet
If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
Dim shUser As Worksheet
Dim sht As Worksheet
Dim lTopRow As Long
Dim lLeftCol As Long
Dim sAddr As String
Application.ScreenUpdating = False
' Note the current sheet
Set shUser = ActiveSheet
' take information from current sheet
With ActiveWindow
lTopRow = .ScrollRow
lLeftCol = .ScrollColumn
sAddr = .RangeSelection.Address
End With
' loop through worksheets
For Each sht In ActiveWorkbook.Worksheets
If sht.Visible Then 'skip hidden sheets
sht.Activate
Range(sAddr).Select
ActiveWindow.ScrollRow = lTopRow
ActiveWindow.ScrollColumn = lLeftCol
End If
Next sht
shUser.Activate
Application.ScreenUpdating = True
End Sub
Is there a VBA code to have Excel scroll simultaneously among different sheets (not all sheets, only specific ones)? I would need something like the below but without having ALL sheets move their position...
Sub SynchSheets()
' Duplicates the active sheet's cell position in each sheet
If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
Dim shUser As Worksheet
Dim sht As Worksheet
Dim lTopRow As Long
Dim lLeftCol As Long
Dim sAddr As String
Application.ScreenUpdating = False
' Note the current sheet
Set shUser = ActiveSheet
' take information from current sheet
With ActiveWindow
lTopRow = .ScrollRow
lLeftCol = .ScrollColumn
sAddr = .RangeSelection.Address
End With
' loop through worksheets
For Each sht In ActiveWorkbook.Worksheets
If sht.Visible Then 'skip hidden sheets
sht.Activate
Range(sAddr).Select
ActiveWindow.ScrollRow = lTopRow
ActiveWindow.ScrollColumn = lLeftCol
End If
Next sht
shUser.Activate
Application.ScreenUpdating = True
End Sub