worksheets scrolling

  • Thread starter Thread starter Fan924
  • Start date Start date
F

Fan924

Can two worksheets be synchronized so that they scroll together? If I
scroll down to line 500 on sheet1 and then switch to sheet2, it too
will be at line 500.
 
Not exactly...
'Place this code in the module behind Sheet1.
'--
'Sheet1
Private Sub Worksheet_Deactivate()
On Error GoTo DoRight
If ActiveSheet.Name = "Sheet2" Then
Dim lngRowNum As Long
Application.EnableEvents = False
Me.Activate
lngRowNum = ActiveWindow.VisibleRange.Row
Sheets("Sheet2").Activate
ActiveWindow.ScrollRow = lngRowNum
Application.EnableEvents = True
End If
Exit Sub
DoRight:
Application.EnableEvents = True
End Sub
--
Jim Cone
Portland, Oregon USA



"Fan924"
wrote in message
Can two worksheets be synchronized so that they scroll together? If I
scroll down to line 500 on sheet1 and then switch to sheet2, it too
will be at line 500.
 
Hi,

I'm sure there must be a way to get the ScrollRow property of an inactive
sheet and perhaps someone will tell us how. In the meantime try this:-

Alt +F11 to open VB editor, right click 'This Workbook' and insert module
and paste the colde below in.

Sub MySub()
Sheets("Sheet1").Select
ScrollTo = ActiveWindow.ScrollRow
Sheets("Sheet2").Select
ActiveWindow.ScrollRow = ScrollTo
End Sub

Then on the left side double click "Sheet2" and paste this code in

Private Sub Worksheet_Activate()
Application.EnableEvents = False
MySub
Application.EnableEvents = True
End Sub

Close VB editor and whenever sheet 2 is selected it will scroll to the same
row as sheet 1.

Mike
 

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

Similar Threads

Vertical scrollbar screwed up 4
Excel Moving data to sheet2 from sheet1 0
Frame control scroll bar 0
Finding and transfering data 2
combo box 1
Worksheet Scroll Increment 2
PowerPoint Embed scroll excel chart and data in powerpoint 0
loop to copy paste 5

Back
Top