Open Workbook At A Set Page

  • Thread starter Thread starter Brian Hearty via OfficeKB.com
  • Start date Start date
B

Brian Hearty via OfficeKB.com

There is a web site called www.officearticles.com that explains some good
tips on using excel. However, I am having difficulties getting one of the
tips to work.
To ensure that a workbook is opened at a specific page regardless of where
the last user was within the book when he/she saved and closed it the
following piece of VB code is suggested:

While in Visual Basic Editor, double-click ThisWorkbook and enter the
following code:
Private Sub Workbook_Open()
Range("Sheet1!A1").Activate
End Sub

Unfortunately I get a run time error each time I attempt to run it - is there
something extra that needs to be included in the code in order for it to run
correctly?
 
Hi Brian

Do you have a Sheet1?
If not change code to include your sheet name.

Regards

Roger Govier
 
Hi Roger

Thanks for the response. Yes I've tried Sheet1 and an actual sheet name but
no success either way.

Brian


Roger said:
Hi Brian

Do you have a Sheet1?
If not change code to include your sheet name.

Regards

Roger Govier
There is a web site called www.officearticles.com that explains some good
tips on using excel. However, I am having difficulties getting one of the
[quoted text clipped - 12 lines]
something extra that needs to be included in the code in order for it to run
correctly?
 
Good morning Brian Hearty

The code seems sound enough, and from your description, you are
certainly pasting it to the right place. But do you have a sheet named
"Sheet1"...?

HTH

DominicB
 
Try this instead

Private Sub Workbook_Open()

Worksheets("Sheet1").Activate
Range("A1").Activate

End Sub
 
Top Man!
Thanks for all the responses on this, the last one from stringstroker62 works
a dream.

Thanks
Brian
 

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

Back
Top