Leaving the cursor at a known position on a worksheet

J

John

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
 
P

Per Jessen

Hi

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

or

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

Hopes this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top