+ Reply to Thread
Results 1 to 4 of 4

Trouble resetting array

  1. #1
    Registered User
    Join Date
    03-29-2012
    Location
    Ottawa, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    90

    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
    Excel 2016
    Posts
    4,300

    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
    Registered User
    Join Date
    03-29-2012
    Location
    Ottawa, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    90

    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
    Excel 2016
    Posts
    4,300

    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)

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