Hello,
I would like to know how to stay on the same row when selecting another sheet.
My file contains 17 sheets. Sheets 2 and 5 till 16 contain names and will be refered to as target sheets.
When I select one of these names on one of the target sheets and select another target sheet, I would like the same name on the same row selected.
Example:
I input some data on row 17 of sheet 2. On sheet 5 I input some more data on the same row. So I would like row 17 to be selected when I select sheet 5.
When I input some data on row 187 of sheet 2 and go back to sheet 5, the active row will still be 17. It would speed up the process if row 187 would already be selected.
I hope I made myself clear.
Best regards,
Trowa
Configuration: Windows 2003 Internet Explorer 7.0
Hello Trowa,
Option Explicit Dim LastTarget As String Dim FirstVisibleCell As String Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range) LastTarget = Target.Address FirstVisibleCell = "R" & ActiveWindow.VisibleRange.Row & "C" & ActiveWindow.VisibleRange.Column End Sub Private Sub Workbook_SheetActivate(ByVal Sh As Object) On Error Resume Next Application.EnableEvents = False Application.Goto Reference:=FirstVisibleCell, Scroll:=True Range(LastTarget).Select Application.EnableEvents = True End Sub Best regards "Pour trouver une solution à ses problèmes, il faut s'en donner la peine." |