+ Reply to Thread
Results 1 to 5 of 5

run time error 1004 range of object _worksheet failed

  1. #1
    Forum Contributor
    Join Date
    01-07-2004
    Posts
    314

    run time error 1004 range of object _worksheet failed

    Hi all,

    Using Excel 2010.
    The array, "aInput" is a vector: 1 column by 100K rows
    The debug.print is printing a space first, then 100000 - which seems a little od an me be a tell as to why I am receiving the error message

    The code below, debugs on the "Set" line
    Any ideas?

    thx
    w

    Please Login or Register  to view this content.
    Kind regards,
    w

    http://dataprose.org

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: run time error 1004 range of object _worksheet failed

    What is the variable declaration of rngOutputDescriptions?


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: run time error 1004 range of object _worksheet failed

    Hi goss,

    No, you cannot have a space when setting a range. See if this line of code solves the issue:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,662

    Re: run time error 1004 range of object _worksheet failed

    Array dimensions are always type Long so CLng(UBound(aInput)) servers no purpose.
    The space preceeding numbers debug printed is reserved for the minus sign. It's simply debug's output formatting and is not a part of the number.
    What is the With statement that .Range is tied to?

    There's nothing wrong with: .Range("A1:A" & lRowsOuput)

    But it must be a part of a With..End With block:
    Please Login or Register  to view this content.
    But you did not show the entire code so we don't know if that dot-range statement is dangling by itself....
    Last edited by protonLeah; 12-16-2013 at 03:08 AM.
    Ben Van Johnson

  5. #5
    Forum Contributor
    Join Date
    01-07-2004
    Posts
    314

    Re: run time error 1004 range of object _worksheet failed

    Thanks guys,

    I looked at it for many hours off and on and never saw the spelling typo - until this morning (lRowsOutput / lRowsOuput)
    Please Login or Register  to view this content.
    thx
    w
    Last edited by goss; 12-16-2013 at 08:49 AM. Reason: typo

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How can I resolve this Run-Time error '1004': Method 'Range' of object '_Worksheet' failed
    By dafella in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2013, 01:16 AM
  2. [SOLVED] Run-time error '1004': Method 'Select' of object'_Worksheet' failed
    By vbiggs101 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-07-2013, 02:56 PM
  3. Run time Error 1004 Method 'Range' object '_Worksheet 'failed
    By Monica1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2013, 07:42 AM
  4. me too - run-time error '1004' method 'range' of object '_worksheet' failed
    By ASAFSWIS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2013, 05:14 PM
  5. [SOLVED] Name a dynamic range - Run-time error 1004 Method 'Range' of object'_Worksheet' failed
    By DavidBW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-03-2012, 08:00 AM

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