+ Reply to Thread
Results 1 to 7 of 7

Excel VBA Runtime error 1004 "Select method of Range class failed"

  1. #1
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Excel VBA Runtime error 1004 "Select method of Range class failed"

    Hi

    Can anyone explain why I get a Excel VBA Runtime error 1004 "Select method of Range class failed" when I run the code below? Every time it runs it stops on the line shaded red below.

    Please Login or Register  to view this content.
    The only thing I can think of as to why it is causing an error is the range it is selecting has a frozen pane on the top row, would this cause a problem? I have tried changing it to A1:A10000 but it still produces an error. Can anyone help?

    Thanks,

    Jeskit
    Last edited by jeskit; 02-09-2012 at 10:16 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Excel VBA Runtime error 1004 "Select method of Range class failed"

    No need to select at all:

    Please Login or Register  to view this content.
    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Excel VBA Runtime error 1004 "Select method of Range class failed"

    Hi

    Thank you that works great however I am now getting the same error on the line below.

    Please Login or Register  to view this content.
    Thank you for your help!

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Excel VBA Runtime error 1004 "Select method of Range class failed"

    Still no need to select
    Please Login or Register  to view this content.
    Good luck.

  5. #5
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Excel VBA Runtime error 1004 "Select method of Range class failed"

    HI

    Thanks works great. But everytime I have range().select it produces this error. Do you know why this is? Is it because i am using a VB button object?

    Please Login or Register  to view this content.
    Thank you so much for your help!

  6. #6
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Excel VBA Runtime error 1004 "Select method of Range class failed"

    Your code is most likely in a worksheet module, in which case Range("blah") always refers to a range on the sheet containing the code. If you have activated a different sheet, it will fail. You need to specify the sheet as well as the range - for example
    Please Login or Register  to view this content.
    or use a With...End With statement
    Please Login or Register  to view this content.
    However, as both Domski and I have said, there is almost never a need to select a cell, or a sheet, to manipulate it.

  7. #7
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Excel VBA Runtime error 1004 "Select method of Range class failed"

    Thank you so much it works great!!!!

    Thank you all for all your help it was all greatly appreciated!!!

+ 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