+ Reply to Thread
Results 1 to 4 of 4

Multiple For Each Loops with Worksheet Object?

  1. #1
    Registered User
    Join Date
    09-10-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    5

    Multiple For Each Loops with Worksheet Object?

    Is it possible to have multiple For Each Loops in one Procedure that targets the Work Sheet Object

    IE:

    For each ws in ThisWorkbook.Worksheets
    'Do This
    Next ws


    For each ws in ThisWorkbook.Worksheets
    'Do That
    Next ws


    Or does the variable name have to be different?

  2. #2
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Multiple For Each Loops with Worksheet Object?

    Shouldn't be as far as I'm aware. This references it:

    http://www.excel-easy.com/vba/loop.html

    Please Login or Register  to view this content.

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

    Re: Multiple For Each Loops with Worksheet Object?

    Do you need 2 separate loops for the same workbook and worksheets?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    09-10-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Multiple For Each Loops with Worksheet Object?

    @Norie I need to separate loops for go through the worksheets, it will be in two different areas of the code and do something different

+ 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. Progress indicator for macro that loops through each worksheet
    By gazza365 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-17-2011, 10:48 PM
  2. Multiple Loops in a do until?
    By thehustler in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2011, 01:31 PM
  3. VBA loops: conditional copy to another worksheet
    By baucucu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2008, 05:33 AM
  4. [SOLVED] plot graph from multiple worksheet as embedded chart object on every worksheet
    By Jeffrey.Tiong@gmail.com in forum Excel General
    Replies: 0
    Last Post: 08-22-2006, 05:45 PM
  5. plot graph from multiple worksheet as embedded chart object on every worksheet
    By Jeffrey.Tiong@gmail.com in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 08-22-2006, 05:45 PM
  6. plot graph from multiple worksheet as embedded chart object on every worksheet
    By Jeffrey.Tiong@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2006, 05:45 PM
  7. plot graph from multiple worksheet as embedded chart object on every worksheet
    By Jeffrey.Tiong@gmail.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-22-2006, 05:45 PM
  8. Eliminating Multiple IF/THEN loops
    By JC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2006, 02: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