ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Synchronize sheets by row? (https://www.excelbanter.com/excel-programming/425634-synchronize-sheets-row.html)

jrcruzr

Synchronize sheets by row?
 
I'm using Excel 2002. Is there a way to toggle between 2 sheets pointing on
the same row number? Example: Sheet1 R1C1, when I select Sheet2 cursor points
to the same address R1C1.

Thanks in advance,
--
rcruz

Rick Rothstein

Synchronize sheets by row?
 
You should be able to use this worksheet event code...

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" Or Sh.Name = "Sheet2" Then Sh.Range("A1").Select
End Sub

Note: I don't have XL2002, rather I have XL2003; but I think the above
should work for either version.

--
Rick (MVP - Excel)


"jrcruzr" wrote in message
...
I'm using Excel 2002. Is there a way to toggle between 2 sheets pointing
on
the same row number? Example: Sheet1 R1C1, when I select Sheet2 cursor
points
to the same address R1C1.

Thanks in advance,
--
rcruz



Per Jessen

Synchronize sheets by row?
 
If you want to take the cursor to current row when you change sheet then you
need this:

Declare the variable in an ordinary module :
Public ActiveRow As Long

Place this in the codesheet for Sheet1 and Sheet2:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveRow = ActiveCell.Row
End Sub

Place this in the codesheet for ThisWorkbook:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" Or Sh.Name = "Sheet2" Then
Cells(ActiveRow, 1).Select
End If
End Sub

---
Per

"jrcruzr" skrev i meddelelsen
...
I'm using Excel 2002. Is there a way to toggle between 2 sheets pointing
on
the same row number? Example: Sheet1 R1C1, when I select Sheet2 cursor
points
to the same address R1C1.

Thanks in advance,
--
rcruz



Chip Pearson

Synchronize sheets by row?
 
Open the ThisWorkbook module and enter the following code:

Private LastAddr As String

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
On Error Resume Next
Sh.Range(LastAddr).Select
End Sub

Private Sub Workbook_SheetSelectionChange( _
ByVal Sh As Object, ByVal Target As Range)
LastAddr = Target.Address
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Mon, 16 Mar 2009 12:31:01 -0700, jrcruzr
wrote:

I'm using Excel 2002. Is there a way to toggle between 2 sheets pointing on
the same row number? Example: Sheet1 R1C1, when I select Sheet2 cursor points
to the same address R1C1.

Thanks in advance,



All times are GMT +1. The time now is 10:09 PM.

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