PDA

View Full Version : Run time error '1004':Select method of worksheet class failed



maryam
05-08-2007, 10:44 PM
I got this error Runtime error '1004': Select Method of Worksheet class failed and the bold part is yellow. I just add one control to my command bar and then I recieve this error when I start.
Sheets("Mainsheet").Select
'Sub AssignMacros()
With Application.CommandBars("Object Palette1")
With .Controls("&Drawing")
.OnAction = ""
End With
With .Controls("&Select Objects")
.OnAction = ""
End With

JimmyTheHand
05-08-2007, 11:25 PM
Try completing the expression with workbook reference, e.g.

ThisWorkbook.Sheets("Mainsheet").Select
or
Workbooks("something.xls").Sheets("Mainsheet").Select

Jimmy

Paul_Hossler
05-09-2007, 05:37 AM
Q: Is the Sheets ... outside of the Sub?

Q2: why is the 'Sub line commented out?

Charlize
05-09-2007, 11:18 AM
1. Maybe your sheet is hidden.
2. Maybe your sheet doesn't have that name.

Charlize