+ Reply to Thread
Results 1 to 6 of 6

Help with arrays

  1. #1
    Registered User
    Join Date
    07-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    38

    Help with arrays

    Hello,

    I am writing code to store and later paste/print items from an array based on user input and selection of checkboxes. The array seems to work fine for the first For/Next, but when the next "n" integer comes around, I get an out of range error. I have no idea how to fix this and I am open to any suggestions!

    Thank you!

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Help with arrays

    Hi,

    Could you please upload a sample workbook with your code in it, along with some instructions on how to use the workbook to reproduce the error, and what outputs you would expect to see if the code ran perfectly?

    Thanks

  3. #3
    Registered User
    Join Date
    07-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Help with arrays

    Hello,

    It's not a workbook, but a word document. It's in its infancy, but the idea is that the user would check boxes on the page, then enter a "note" related to the checkboxes ("tags"). Each note can have one more chechbox tags.

    It should loop through all the checkboxes for each note, then ask for another note, and repeat, until the user decides there are no more notes to tag/assign checkboxes to.

    DOes that help?

  4. #4
    Registered User
    Join Date
    07-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Help with arrays

    here is the attachment
    Attached Files Attached Files

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Help with arrays

    The error is because when using ReDim Preserve you can only redim the last dimension.

    What exactly are you trying to get in the array?

    Does it need to be 2-dimensional?
    If posting code please use code tags, see here.

  6. #6
    Registered User
    Join Date
    07-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Help with arrays

    I thought it might be the ReDim, but I dno't understand how to fix it or why that line of code is wrong. I am trying to have the array "remember" each note and the checkboxes that relate to the note so that, later, I can print out the array such that the notes are matched with the one or more checkboxes that were checked for it. Ideally, the print out would look like this:

    Note1 Tag/Checkbox1 Tag/Checkbox2
    Note2 Tag/Checkbox1 Tag/Checkbox2
    Note3 Tag/Checkbox1 Tag/Checkbox2


    Etc., until the user has entered all the notes they would like to enter. The output feeds into a larger macro, so this is just a small piece (which is why it looks odd, I am sure).

    Any help you can give is hugely appreciated.

+ 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] New to arrays-where do I find a good beginners guide to multi dimensional arrays
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-04-2013, 07:44 PM
  2. Sum columns within arrays and then multiplying arrays [?]
    By slickpusher in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-08-2012, 08:50 PM
  3. Returning arrays from arrays....
    By Magsy in forum Excel General
    Replies: 2
    Last Post: 12-13-2011, 09:09 AM
  4. Help With Arrays, real Basic Arrays
    By Markva in forum Excel General
    Replies: 3
    Last Post: 08-20-2008, 04:11 PM
  5. [SOLVED] Arrays - declaration, adding values to arrays and calculation
    By Maxi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2006, 11:15 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