simultaneous scrolling among certain sheets

esbencito

New Member
Joined
May 22, 2017
Messages
16
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
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
You might try...

Code:
Sub SynchSomeSheets()
' 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
    [COLOR=#ff0000]If sht.Name = "Sheet2" Or sht.Name = "Sheet4" Then 'change to match your sheet names[/COLOR]
        sht.Activate
        Range(sAddr).Select
        ActiveWindow.ScrollRow = lTopRow
        ActiveWindow.ScrollColumn = lLeftCol
    End If
Next sht

shUser.Activate
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks!! But it doesn't seem to work as wished...

It seems to scroll a few rows and columns in the other sheets, but only if I run the Macro every time before I scroll (can I have it run permanently in the background?), and it doesn't move to the exact same position as in the active sheet!

Code:
Sub SynchSomeSheets()
' 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.Name = "TTL APAC" Or sht.Name = "Japan" Or sht.Name = "Korea" Or sht.Name = "HK Hub" Or sht.Name = "China" Or sht.Name = "HMT" Or sht.Name = "SEA" Or sht.Name = "ANZ" Then
        sht.Activate
        Range(sAddr).Select
        ActiveWindow.ScrollRow = lTopRow
        ActiveWindow.ScrollColumn = lLeftCol
    End If
Next sht


shUser.Activate
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top