+ Reply to Thread
Results 1 to 13 of 13

Run-time error '1004' Select method of range class failed

  1. #1
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    134

    Run-time error '1004' Select method of range class failed

    When I am in an excel document and I click on a hyperlink to take me to another excel document when it opens the second document I get the above error. I can either click on end or help. Continue and Debug are grayed out. How can I get rid of this error? Any help would be much appreciated. Thank you in advance.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '1004' Select method of range class failed

    Have you checked the code in the workbook causing the error?
    If posting code please use code tags, see here.

  3. #3
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Run-time error '1004' Select method of range class failed

    sounds like the excel document you are using may have been created on a later version of excel, and that there may be a reference missing in the VBA reference section. The file is protected and thats why you cant get the full error or fix it.
    You will need to go back to who ever designed the workbook to get them to unlock it or sort the error out.

    Sean

  4. #4
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    134

    Re: Run-time error '1004' Select method of range class failed

    Thanks Norie and Sean, I created the both documents. I have them protected because we seem to have people like to go in and change things and they create more issues. I did unprotect the document and I don't get the error now, but I need to have the document protected or people will just go in and change whatever they want to change and I have tons of hyperlinks in the documents. Do either of you have any other suggestions? Thanks!

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '1004' Select method of range class failed

    Is there any code in either workbook?

  6. #6
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    134

    Re: Run-time error '1004' Select method of range class failed

    I am not that savy on codes, but I have a macro that can run. I created one to lock or unlock all worksheets at one time. I did find this code.

    Please Login or Register  to view this content.
    Not sure what it is.
    Last edited by jeffreybrown; 11-14-2012 at 01:42 PM. Reason: As per the forum rules, please use code tags...Thanks.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '1004' Select method of range class failed

    All that does is select A1 on the worksheet.

    Is that definitely the only other code than your lock/unlock code?

  8. #8
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    134

    Re: Run-time error '1004' Select method of range class failed

    I think, is there a way to check for sure?

  9. #9
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    134

    Re: Run-time error '1004' Select method of range class failed

    I think I have another code in there. It is the following:

    Private Sub Workbook_Open()
    Sheets("Summary").Activate
    End Sub
    That way when someone goes into the workbook it goes to the Summary page. Could this be the problem.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '1004' Select method of range class failed

    Triscia

    The only way to check for code is to open the VBE and check all the modules.

    That code might be the cause of the problem or it could be the other code.

    Why not comment out both sets of code, save the workbook and try again?

    PS I'm assuming this code is in the workbook the hyperlink opens.

  11. #11
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    134

    Re: Run-time error '1004' Select method of range class failed

    Yes, the codes are in the workbook the hyperlink opens. I am not sure how to commnet out both sets of codes. Here are the modules for this workbook.

    Sub ProtectAll()

    Dim wSheet As Worksheet
    Dim Pwd As String

    Pwd = InputBox("Enter your password to protect all worksheets", "Password Input")
    For Each wSheet In Worksheets
    wSheet.Protect Password:=Pwd
    Next wSheet

    End Sub

    Sub UnProtectAll()

    Dim wSheet As Worksheet
    Dim Pwd As String

    Pwd = InputBox("Enter your password to unprotect all worksheets", "Password Input")
    On Error Resume Next
    For Each wSheet In Worksheets
    wSheet.Unprotect Password:=Pwd
    Next wSheet
    If Err <> 0 Then
    MsgBox "You have entered an incorect password. All worksheets could not " & _
    "be unprotected.", vbCritical, "Incorect Password"
    End If
    On Error GoTo 0

    End Sub

  12. #12
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Run-time error '1004' Select method of range class failed

    If you have unprotected the workbook and all is ok, then you must have some code in there which locks or unlocks. When you say you unprotected it, was that for the workbook or the VBA?
    can you post the workbook? it would be easier to look at the code for you.

    Sean

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '1004' Select method of range class failed

    Triscia

    Is the workbook protected when you open it with the hyperlink?

+ 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.6.0 RC 1