Consulting

Results 1 to 4 of 4

Thread: Run time error '1004':Select method of worksheet class failed

  1. #1

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

    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

  2. #2
    Try completing the expression with workbook reference, e.g.

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

    Jimmy
    -------------------------------------------------
    The more details you give, the easier it is to understand your question. Don't save the effort, tell us twice rather than not at all. The amount of info you give strongly influences the quality of answer, and also how fast you get it.

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,730
    Location
    Q: Is the Sheets ... outside of the Sub?

    Q2: why is the 'Sub line commented out?

  4. #4
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    1. Maybe your sheet is hidden.
    2. Maybe your sheet doesn't have that name.

    Charlize

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •