Macro Question

C

Crownman

Hi:

I have a group of several files with a simple macro that automatically
goes to a specific worksheet at the time the file is opened. The code
is as follows:

Private Sub Workbook_Open()

Worksheets ("TITLE").Select
Range ("a1").Select

End Sub

The macro works properly when a single file is opened, but when I try
to open several of the files at the same time I get the following
error message:

Run Time Error 1004
Select method of Worksheet Class Failed

All of the files do open, but the macro appears to run on only the
first file selected. All of the other files open to the page that was
active when the file was last saved.

Can my macro be modified to eliminate this behavior?

TIA for any advice.

Crownman
 
D

Dave Peterson

Untested, but I'd try:

Private Sub Workbook_Open()
application.goto me.worksheets("title").range("a1"), scroll:=true
End Sub

(Fully qualifying the range can never hurt--it may not help, but it can't hurt!)

And you are sure that all the workbook have a worksheet named "Title"???
 
C

Crownman

Untested, but I'd try:

Private Sub Workbook_Open()
  application.goto me.worksheets("title").range("a1"), scroll:=true
End Sub

(Fully qualifying the range can never hurt--it may not help, but it can'thurt!)

And you are sure that all the workbook have a worksheet named "Title"???
















--

Dave Peterson- Hide quoted text -

- Show quoted text -

Dave:

That appeared to solve my problem. Thank you for your help.

Crownman
 

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