+ Reply to Thread
Results 1 to 2 of 2

Thread: Run-Time Error '1004'

  1. #1
    Registered User
    Join Date
    05-04-2009
    Location
    Mississippi
    MS-Off Ver
    Excel 2003
    Posts
    1

    Run-Time Error '1004'

    I am trying to figure out why I get the above error at times when using the range method. The simplest I can get is the following code:

    Private Sub CommandButton1_Click()
      Worksheets("Sheet2").Range("A1").Activate
    End Sub
    If the button in question is on Sheet1, I get the following error:

    Run-time error '1004':

    Activate method of Range class failed

    Can anyone explain what causes the error to pop up?

    Thanks!

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: Run-Time Error '1004'

    You can't activate a range an inactive sheet. You can do this:
    Application.GoTo Worksheets("Sheet2").Range("A1")
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0