+ Reply to Thread
Results 1 to 9 of 9

Run Macro based on listed value in Column A minus header

  1. #1
    Registered User
    Join Date
    10-21-2016
    Location
    Broken Arrow, Oklahoma
    MS-Off Ver
    2010
    Posts
    64

    Run Macro based on listed value in Column A minus header

    Hi,

    I have values ranging from A2:A22. A1 is the header row. Is there a way to tell VBA to run the macro through each value listed in column A until there is no value? For example:

    If A2 has value, run macro.
    Then if A3 has value, run macro.
    and so forth until the list is complete.

  2. #2
    Valued Forum Contributor
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,067

    Re: Run Macro based on listed value in Column A minus header

    Hi ahuang3433,

    Perhaps something like this ...
    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Registered User
    Join Date
    10-21-2016
    Location
    Broken Arrow, Oklahoma
    MS-Off Ver
    2010
    Posts
    64

    Re: Run Macro based on listed value in Column A minus header

    Hi nankw83,

    Where do I plug in my code in what you describe above?

  4. #4
    Valued Forum Contributor
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,067

    Re: Run Macro based on listed value in Column A minus header

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-21-2016
    Location
    Broken Arrow, Oklahoma
    MS-Off Ver
    2010
    Posts
    64

    Re: Run Macro based on listed value in Column A minus header

    In addition to the request above, I failed to state that I am also looking for a code where I filter by each value from sheet 1 column A starting from A2, on a different sheet of column B. Is that doable?

  6. #6
    Registered User
    Join Date
    10-21-2016
    Location
    Broken Arrow, Oklahoma
    MS-Off Ver
    2010
    Posts
    64

    Re: Run Macro based on listed value in Column A minus header

    I've attached 2 different workbooks to try to make what I'm saying simpler. Book 3 are the criteria list values. Book 2 is the list that I want to filter.

    Intent:

    Use A2 criteria of book 3 and filter on book 2

    Run my remaining script.

    Then proceed to A3 criteria of book 3 and filter on book 2

    Run my remaining script.

    Then proceed to A4 criteria of book 3 and filter on book 2

    This process will repeat itself until the criteria list of book 3 is blank.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,067

    Re: Run Macro based on listed value in Column A minus header

    Try below code ... If you post your full code & what exactly you're trying to achieve perhaps we could suggest something better

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-21-2016
    Location
    Broken Arrow, Oklahoma
    MS-Off Ver
    2010
    Posts
    64

    Re: Run Macro based on listed value in Column A minus header

    Hi nankw83,

    Sorry for the confusion. Here is the code that I have. I am trying to change this portion of the code where instead of filtering the whole list altogether, to making it filter 1 value at a time and save the file individually and then go to the next variable until there is no more values to filter through on column A. Hope this makes sense.

    Please Login or Register  to view this content.
    The whole code is in a notepad format due to firewall restrictions.
    Attached Files Attached Files
    Last edited by ahuang3433; 04-08-2021 at 03:33 PM.

  9. #9
    Valued Forum Contributor
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,067

    Re: Run Macro based on listed value in Column A minus header

    Based on your sample files in post #6, try below code in 'Book2'

    Please Login or Register  to view this content.

+ 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. Replies: 6
    Last Post: 01-08-2019, 04:53 AM
  2. macro to lock cell by column header based on value in another cell by column header
    By Closet Guru in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2015, 12:36 PM
  3. Replies: 4
    Last Post: 03-31-2015, 11:40 AM
  4. [SOLVED] need macro that prints sheets listed in column a and the # of copies i want in column b
    By ffxmp0 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-10-2012, 11:22 PM
  5. [SOLVED] Calculating the count of the item listed in the column header
    By kwhite523 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-15-2012, 10:58 AM
  6. Replies: 8
    Last Post: 12-22-2008, 09:40 PM
  7. Macro to rearrange/add columns based on column header?
    By drdavidge in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2006, 09:35 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