I have several worksheets which are the same layout, with different
information, all related. I would like to move around in one sheet, and when
i go to another sheet, have the same position displayed. I do not want any
changes I make to a cell on one sheet to hard enter on the other sheet, so
highlighting all the tabs is not an option.
I would like that when I go to another sheet, the same cell is in the window
to see the effects, rather than scroll around to find it.
If you want to use a couple of macros, you can do it.
Option Explicit
Dim CurActCellAddr As String
Dim TopLeftCellAddr As String
Private Sub Workbook_Open()
CurActCellAddr = ActiveCell.Address
TopLeftCellAddr = ActiveWindow.VisibleRange.Cells(1, 1).Address
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If CurActCellAddr = quot;quot; Then
'do nothing
Else
With Application
.EnableEvents = False
If TopLeftCellAddr = quot;quot; Then
'do nothing
Else
.Goto Sh.Range(TopLeftCellAddr), scroll:=True
End If
Sh.Range(CurActCellAddr).Select
.EnableEvents = True
End With
End If
CurActCellAddr = ActiveCell.Address
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
CurActCellAddr = ActiveCell.Address
TopLeftCellAddr = ActiveWindow.VisibleRange.Cells(1, 1).Address
End Subrightclick on the excel icon to the left of the File|edit|view (on the worksheet
menubar).
select view code and paste this in.
Then try it out.
The first time the address gets initialized is with the workbook open event. If
you test without closing/reopening your workbook, it may take one selection
change to quot;prime the pump.quot;
Duane wrote:
gt;
gt; I have several worksheets which are the same layout, with different
gt; information, all related. I would like to move around in one sheet, and when
gt; i go to another sheet, have the same position displayed. I do not want any
gt; changes I make to a cell on one sheet to hard enter on the other sheet, so
gt; highlighting all the tabs is not an option.
gt;
gt; I would like that when I go to another sheet, the same cell is in the window
gt; to see the effects, rather than scroll around to find it.
--
Dave Peterson
- Jul 20 Thu 2006 20:08
Navigating in Excel sheets
close
全站熱搜
留言列表
發表留言