![]() |
Workbook jumps to Sheet1, cell A1, regardless of where it was whenlast saved
I use the following macro to jump to a particular worksheet when a
workbook is opened and Sheet1!O70=0, however I'd like to modify it so that when those conditions are met, the cursor will rest on a particular cell such as A1. Are there any suggestions? Thanks in advance. Michael Private Sub Workbook_Open() With Me If .Worksheets("Sheet1").Range("O70").Value = 0 Then .Worksheets("Sheet1").Activate End If End With End Sub |
Workbook jumps to Sheet1, cell A1, regardless of where it was when last saved
maybe this:
Private Sub Workbook_Open() With Me If .Worksheets("Sheet1").Range("O70").Value = 0 Then .Worksheets("Sheet1").Activate Application.Goto .Worksheets("Sheet1").Range("A1"), scroll:=True End If End With End Sub -- Gary Keramidas Excel 2003 "Michael Lanier" wrote in message ... I use the following macro to jump to a particular worksheet when a workbook is opened and Sheet1!O70=0, however I'd like to modify it so that when those conditions are met, the cursor will rest on a particular cell such as A1. Are there any suggestions? Thanks in advance. Michael Private Sub Workbook_Open() With Me If .Worksheets("Sheet1").Range("O70").Value = 0 Then .Worksheets("Sheet1").Activate End If End With End Sub |
Workbook jumps to Sheet1, cell A1, regardless of where it was whenlast saved
Since you're using application.goto, you don't even need to activate sheet1.
Gary Keramidas wrote: maybe this: Private Sub Workbook_Open() With Me If .Worksheets("Sheet1").Range("O70").Value = 0 Then .Worksheets("Sheet1").Activate Application.Goto .Worksheets("Sheet1").Range("A1"), scroll:=True End If End With End Sub -- Gary Keramidas Excel 2003 "Michael Lanier" wrote in message ... I use the following macro to jump to a particular worksheet when a workbook is opened and Sheet1!O70=0, however I'd like to modify it so that when those conditions are met, the cursor will rest on a particular cell such as A1. Are there any suggestions? Thanks in advance. Michael Private Sub Workbook_Open() With Me If .Worksheets("Sheet1").Range("O70").Value = 0 Then .Worksheets("Sheet1").Activate End If End With End Sub -- Dave Peterson |
Workbook jumps to Sheet1, cell A1, regardless of where it waswhen last saved
Thanks Gary and Dave. It works as expected.
Michael |
All times are GMT +1. The time now is 05:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com