Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Leaving the cursor at a known position on a worksheet

How do I correct the following code to not give a 1004 error:
NewStatusSheetName = "newsheetname"
....
Sheets(NewStatusSheetName).Range("$A$1").Select
....
My macro jumps between two sheets and I want to leave the cursor at the top
of the new sheet at the end. I found that the following works, but I don't
know if a Go To is the best solution:
Application.Goto Sheets(NewStatusSheetName).Range("$H$1")

I appreciate your help, -John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Leaving the cursor at a known position on a worksheet

Hi

Set NewStatusSheet = Worksheets("NewSheetName")
NewStatusSheet.Range("$A$2").Select

or

NewStatusSheetName = "NewStatusSheet"
Worksheets(NewSheetName).Activate
Range("$A$2").Select

Hopes this helps.

---
Per

"John" skrev i meddelelsen
...
How do I correct the following code to not give a 1004 error:
NewStatusSheetName = "newsheetname"
....
Sheets(NewStatusSheetName).Range("$A$1").Select
....
My macro jumps between two sheets and I want to leave the cursor at the
top
of the new sheet at the end. I found that the following works, but I
don't
know if a Go To is the best solution:
Application.Goto Sheets(NewStatusSheetName).Range("$H$1")

I appreciate your help, -John


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
Cursor position saziz Excel Discussion (Misc queries) 2 August 9th 05 08:19 PM
VBA code for cursor movement without leaving scroll area mikeburg[_4_] Excel Programming 3 July 1st 05 03:59 PM
Cursor Position in VBE ehntd[_5_] Excel Programming 0 November 3rd 04 08:44 AM
Cursor Position in VBE ehntd[_4_] Excel Programming 1 November 2nd 04 05:50 PM
cursor position Fan Fan Excel Programming 3 August 14th 04 01:12 AM


All times are GMT +1. The time now is 03:41 AM.

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

About Us

"It's about Microsoft Excel"