Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Set Focus on Cell D8

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Set Focus on Cell D8

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Set Focus on Cell D8

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Set Focus on Cell D8

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Set Focus on Cell D8

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable cell focus [email protected] Excel Discussion (Misc queries) 1 April 26th 09 12:04 AM
Active Cell/Focus Rich W. Excel Discussion (Misc queries) 6 March 19th 08 04:59 PM
Set focus to cell? No Name Excel Programming 1 December 29th 04 01:10 AM
Cell Lost Focus Craig[_5_] Excel Programming 1 July 23rd 03 05:18 AM
Highlight Cell on Focus Nigel Graham Excel Programming 4 July 23rd 03 03:39 AM


All times are GMT +1. The time now is 02:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"