+ Reply to Thread
Results 1 to 6 of 6

run-time 1004 when referencing a range

  1. #1
    Forum Contributor
    Join Date
    01-06-2011
    Location
    cleveland
    MS-Off Ver
    Excel 2007
    Posts
    225

    run-time 1004 when referencing a range

    Please Login or Register  to view this content.

    errors on the two statements attempting to clear. i have been through all my resources and they are saying this should be correct so it must be something silly i am missing. is this the proper way to address this range when using a variable?

    thank you

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: run-time 1004 when referencing a range

    Hi,

    What are the values of B6, B13 & B14?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: run-time 1004 when referencing a range

    Hi try this
    Please Login or Register  to view this content.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  4. #4
    Forum Contributor
    Join Date
    01-06-2011
    Location
    cleveland
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: run-time 1004 when referencing a range

    B6 is the following function which returns a value of 31
    Please Login or Register  to view this content.
    B13 is the following function which returns a value of 477
    Please Login or Register  to view this content.
    B14 is the following function which returns a value of 505
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    01-06-2011
    Location
    cleveland
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: run-time 1004 when referencing a range

    Quote Originally Posted by tom1977 View Post
    Hi try this
    Please Login or Register  to view this content.
    thank you for this help. applying With has fixed my issue. do you happen to know what necessitated this to be declared? i thought i had clearly defined the paths that i was to be working in

  6. #6
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: run-time 1004 when referencing a range

    Your variant variable was ok (I have change this because the long variable has less capacity) Real problem was that fragment of code like this
    Worksheets("user").Range(Cells(1, 1), Cells(StartDelete1 - 1, 1)).Clear
    always refers to active worksheet even You put Worksheets("user"). before this

+ 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