+ Reply to Thread
Results 1 to 3 of 3

Loop Macro with different Sheets

  1. #1
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Loop Macro with different Sheets

    I'm sure there's an easy solution for this, but I can't think of one. I want this macro to run 3 times on 3 different sheets. The second time it would substitute sheets("HAFA QA1") with ("HAFA QA2") and then ("COOP QA1") the third round. Everything else should stay the same. I just wrote the code out 3 times to get the job done at work, but this seems like a sloppy fix. Any ideas?




    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Loop Macro with different Sheets

    Hi,

    Probably something like the following

    Please Login or Register  to view this content.
    Last edited by Richard Buttrey; 12-05-2012 at 06:28 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    02-15-2010
    Location
    Everett, WA
    MS-Off Ver
    All versions; most components
    Posts
    188

    Re: Loop Macro with different Sheets

    You can create an array of the sheet names, then wrap your loop inside a loop through your new array:

    Please Login or Register  to view this content.
    ... or...

    Loop through every sheet in workbook and only operate on the ones with the right names:
    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)

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