+ Reply to Thread
Results 1 to 6 of 6

Subscript out of range

  1. #1
    Registered User
    Join Date
    10-08-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    4

    Subscript out of range

    Here's the code giving me trouble ... The line in red... DateArray() subscript giving problems but can't figure it out...

    Please Login or Register  to view this content.
    Any advice is appreciated. Thanks

  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: Subscript out of range

    What is the value of counter?

    May the the for loop trying to assign a value to a DateArray() more than the assigned counter value


    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
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Subscript out of range

    You can check a couple of things:

    what is the value of LastCell?
    Are the named range in column B? If not, you get an error on this line .Offset(i, -1).Value.
    What is the value of counter?

  4. #4
    Registered User
    Join Date
    10-08-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Subscript out of range

    The Value of Counter is 3 in this case and will neve rbe more than LastCell anyway. I am printing ".Offset(i, -1).Value" and that prints fine...

  5. #5
    Registered User
    Join Date
    10-08-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Subscript out of range

    Solved It -- apparently you cannot use the same variable for external loop if the number of elements are different - which makes sense So I used an internal counter of sort to increment "DateArray" and then it worked fine -- something like

    Please Login or Register  to view this content.

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Subscript out of range

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED",as per our Forum Rule #9. I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

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

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ 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. Subscript OUT OF RANGE
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2011, 08:35 PM
  2. Subscript out of range error while populating array from range.
    By Aussiexile in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-04-2010, 02:22 AM
  3. Subscript out of range error when trying to select a range
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2010, 07:57 PM
  4. Subscript out of Range
    By Jon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2006, 06:30 PM
  5. [SOLVED] subscript out of range
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-31-2005, 03:56 PM

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