PDA

View Full Version : [SOLVED:] What's with this "Run time Error 1004?"



K. Georgiadis
06-23-2005, 08:13 AM
I have 19 worksheets, all with an "Instructions" worksheet and with a simple macro in ThisWorkbook:


Sheets("Instructions").Select
Range("A1").Select


All is well if the files are opened one by one but, if the user opens them all at once with FILE>OPEN>SELECT ALL>OPEN, the debug window opens with the following error message:

Run time error '1004'
Select method of worksheet has failed

Is this inevitable if the files are opened simultaneously or is there a workaround?

Thanks!

Killian
06-23-2005, 08:32 AM
The problem here is that the Select method fails if the object it's being applied to isn't active. Activating the current workbook first will solve this


Private Sub Workbook_Open()
ThisWorkbook.Activate
Sheets("Instructions").Select
Range("A1").Select
End Sub

K. Georgiadis
06-23-2005, 08:37 AM
Wonderful! Thanks for your help