Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello -
I have the following code that doesn't work: Sheet2.Activate Range("D8").Select Range("D8").Activate What am I doing wrong? The user clicks a button, it goes through code and at the end, they get switched to Sheet2. It does go to Sheet2, but the selected cell is dependent on where I left it the last time, not on the code above, for some reason. -- Sandy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your code works. Open a new, blank, workbook and paste in:
Sub m() Sheet2.Activate Range("D8").Select Range("D8").Activate End Sub It always takes you to D8 in Sheet2. Something outside you posted code is re-selecting a different cell. -- Gary''s Student "Sandy" wrote: Hello - I have the following code that doesn't work: Sheet2.Activate Range("D8").Select Range("D8").Activate What am I doing wrong? The user clicks a button, it goes through code and at the end, they get switched to Sheet2. It does go to Sheet2, but the selected cell is dependent on where I left it the last time, not on the code above, for some reason. -- Sandy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this and see if it works
Sheets("Sheet2").Range("D8").Select -- Gary "Sandy" wrote in message ... Hello - I have the following code that doesn't work: Sheet2.Activate Range("D8").Select Range("D8").Activate What am I doing wrong? The user clicks a button, it goes through code and at the end, they get switched to Sheet2. It does go to Sheet2, but the selected cell is dependent on where I left it the last time, not on the code above, for some reason. -- Sandy |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Another option (and usually more reliable from my experience)
Application.GoTo Sheets("Sheet2").Range("D8"), True -- Regards, Juan Pablo González Excel MVP "Sandy" wrote in message ... Hello - I have the following code that doesn't work: Sheet2.Activate Range("D8").Select Range("D8").Activate What am I doing wrong? The user clicks a button, it goes through code and at the end, they get switched to Sheet2. It does go to Sheet2, but the selected cell is dependent on where I left it the last time, not on the code above, for some reason. -- Sandy |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All!
Thank you very much!! I ended up using Juan's -- seems like my app needed more of a description of where it should go . . . or something . . . at any rate, it's working now. -- Sandy "Sandy" wrote: Hello - I have the following code that doesn't work: Sheet2.Activate Range("D8").Select Range("D8").Activate What am I doing wrong? The user clicks a button, it goes through code and at the end, they get switched to Sheet2. It does go to Sheet2, but the selected cell is dependent on where I left it the last time, not on the code above, for some reason. -- Sandy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Disable cell focus | Excel Discussion (Misc queries) | |||
Active Cell/Focus | Excel Discussion (Misc queries) | |||
Set focus to cell? | Excel Programming | |||
Cell Lost Focus | Excel Programming | |||
Highlight Cell on Focus | Excel Programming |