+ Reply to Thread
Results 1 to 9 of 9

Vba code to loop thru worksheets based on criteria

  1. #1
    Registered User
    Join Date
    06-04-2015
    Location
    london, ontario
    MS-Off Ver
    7
    Posts
    4

    Cool Vba code to loop thru worksheets based on criteria

    Hi all, I am looking for help on a spreadsheet I have. I want a macro to loop thru my worksheets based on the a criteria and produce the result on another worksheet. In the workbook attached, I want Excel to loop through sheets purchase, sale and refinance based on a date greater than today and give me the result on closing list. Any help will be greatly appreciated.FOR EXCEL FORUM.xlsm

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Vba code to loop thru worksheets based on criteria

    Please Login or Register  to view this content.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vba code to loop thru worksheets based on criteria

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Vba code to loop thru worksheets based on criteria

    Following up with your PM: I have the distinct feeling that the example you posted and your actual source data are not the same.

    My procedure includes branching decision making because the REFINANCE includes data from A:I while the other two worksheets include data from A:D.

    Can you confirm that your original data has a consistent layout, or does it actually differ?

  5. #5
    Registered User
    Join Date
    06-04-2015
    Location
    london, ontario
    MS-Off Ver
    7
    Posts
    4

    Re: Vba code to loop thru worksheets based on criteria

    Yes it has a consistent layout. The code works just great but what I did was I deleted the columns to a column to the left of the spreadsheet and some columns to the right. Once I use my actual spreadsheet then the code does not work. Copy belowFOR EXCEL FORUM.xlsm.xlsx Thanks a billion.

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Vba code to loop thru worksheets based on criteria

    A number of things are different in this new workbook you've provided.

    ClosingList vs 'Closing List'
    A number of hidden worksheets
    The source data is in B:E vs A:D
    Original workbook had hidden columns on Refinance
    New workbook has hidden columns on Closing List

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-04-2015
    Location
    london, ontario
    MS-Off Ver
    7
    Posts
    4

    Re: Vba code to loop thru worksheets based on criteria

    Thanks so much again for your help. This code works great, but what if I don't want it to be all visible sheets and just sheets that I specified. Any further help will be greatly appreciated.

  8. #8
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Vba code to loop thru worksheets based on criteria

    Sorry for the delay, I'm away from the office on a business trip.

    You can absolutely customize the code to fit any number of possibilities. If you want to make it trigger only on sheets you list, you can declare them.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-04-2015
    Location
    london, ontario
    MS-Off Ver
    7
    Posts
    4

    Re: Vba code to loop thru worksheets based on criteria

    Thank you very plenty! It worked like a charm. I can't thank you enough.

+ 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. VBA Code that Sums on a Loop Based on Criteria and Linked to Calender
    By mkeys4 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-24-2013, 09:15 AM
  2. Loop code for certain worksheets in workbook
    By longbow007 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-18-2010, 01:05 AM
  3. Loop code for selected worksheets
    By longbow007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2010, 12:14 AM
  4. Need to loop code for certain worksheets in workbook
    By longbow007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2010, 08:00 AM
  5. [SOLVED] Advancing outer Loop Based on criteria of inner loop
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2005, 01:05 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