+ Reply to Thread
Results 1 to 3 of 3

Create a list in excel macro

  1. #1
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Create a list in excel macro

    Hi all,

    I am trying to create a list in an excel macro. What i mean by this is that basically i am listing a group of cells that i want the macro to look in. the list will be like this but much bigger (A2,A3,A4,B6,B7,B23,C34,C5,C6....) instead of creating hundreds of different for loops, looping through each sheet to find something in that specific cell, i would have to create a for loop for Cell A2, Cell A3..... instead i would like excel to just look at my list and loop through the sheets for that cell then move onto the next cell that i have on the list and loop through all the sheets for that cell.

    I would think i would be setting a variable to be as a list, then listing out all of the cells for it. something like this, but i am not sure

    Please Login or Register  to view this content.
    This is sort of what i am doing

    Thanks in advance for any help. and please let me know if i can help explaining it better, it may be a little confusing.
    I may need to do this as a function instead, but i am not very familiar with that
    Last edited by amotto11; 11-20-2012 at 06:15 PM.
    Regards,
    amotto

    If I helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Create a list in excel macro

    Hi

    I'd put all your cell references into an array
    arr = array("A3","A4","A5","B6") etc
    then loop through them along the lines of
    Please Login or Register  to view this content.
    HTH

    rylo

  3. #3
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Create a list in excel macro

    Rylo,

    Thank you very much, your approach worked perfectly. I had a feeling it would be pretty simple i am just not familiar with arrays.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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