+ Reply to Thread
Results 1 to 4 of 4

Trouble resetting array

  1. #1
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Ottawa, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    104

    Trouble resetting array

    I am having trouble modifying part of a macro I found. The macro use internet explorer to download all HTML tables found on a specific website. It stores the tables information it in an array and then paste that array in a worksheet.The macro work fines but when I recopied the macro to download a 2nd website (I use the exact same one for the example below) I received the following error:
    “Runtime-error '9'”: Subscript out of range

    when running this line of code a 2nd time:
    myarray(intRow, intCol) = objTD.innerText

    From what I found research this, it probably have to do with the array needed to be reset? There is a REDIM before creating the 2nd array for the 2nd website but it still trigger an error. I tried ERASE MY ARRAY but that did not help as well. Complete code is below. Any help would be appreciated, thank you for your time!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Trouble resetting array

    Hi,

    intRow in your second web page is continuing where the first one left off... which means the array does not have an element where the first dimension is 45. You just need to add
    Please Login or Register  to view this content.
    somewhere... an ideal place is between these 2 lines:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Ottawa, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    104

    Re: Trouble resetting array

    it works! Thank you Arkadi for your quick response as well as the explanation, greatly appreciated!

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Trouble resetting array

    Glad I could lend a hand

    I wonder whereabouts in Ottawa you are? I work in Ottawa.

    Thanks for the feedback, marking the thread as solved, as well as the rep... and happy coding!

+ 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. Redimensioning/Resetting a variant array for a new loop iteration
    By Erik_G in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-18-2018, 07:28 AM
  2. Trouble with array formula
    By sipa in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2015, 07:56 AM
  3. Resetting array values to zero using variant
    By gameybeets in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-22-2014, 12:17 PM
  4. Array Formula Trouble
    By braydon16 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-30-2010, 05:01 PM
  5. Array trouble
    By martin_b13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-18-2009, 12:08 PM
  6. URGENT! Need help on resetting an array
    By NSKearns in forum Excel General
    Replies: 0
    Last Post: 08-17-2006, 04:28 AM
  7. [SOLVED] Resetting the array size to Zero.
    By Hari Prasadh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2005, 12:06 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