+ Reply to Thread
Results 1 to 4 of 4

looping through specific sheets in workbook

  1. #1
    Forum Contributor
    Join Date
    04-16-2016
    Location
    bognor
    MS-Off Ver
    Pro-Plus 2016
    Posts
    153

    looping through specific sheets in workbook

    Here is a tricky one.
    I have about 30 sheets in my workbook,the sheets have different names.
    One set of sheets(6 in all) are entitled data1 data2 data3 through to data6.
    what the code does is count the number of rows in each sheet containing data then puts the result into another cell in a seperate sheet(Sheet 11 in this example).
    So far I have used the following code to do this:

    Please Login or Register  to view this content.
    This works OK but it stops if one (or more)of the data sheets has no data in which can some times happen.
    So I have two questions.
    A)Is there a way I could put this into a loop bearing in mind that the 6 sheets are only part of a workbook with lots of other sheets in,so I would only want to loop through those 6 sheets and not the entire workbook.
    B)secondly is there a way that when one or more of the data sheets(in the six sheets) had no data then it just goes on to the next sheet.
    I have had a go but I am not that good with loops
    Any suggestion are always welcome
    Kind regards
    bif

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,079

    Re: looping through specific sheets in workbook

    How about
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-16-2016
    Location
    bognor
    MS-Off Ver
    Pro-Plus 2016
    Posts
    153

    Re: looping through specific sheets in workbook

    Hi Fluff13

    Thankyou for the quick reply the code works perfect and I have managed to adapt it for other bits of the program as well.It's also put loops and arrays into a bit more perspective for me.Again many thanks

    Kind regards
    BIF

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,079

    Re: looping through specific sheets in workbook

    Glad to help & thanks for the feedback

+ 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: 1
    Last Post: 10-04-2013, 04:21 AM
  2. looping thru all sheets within a workbook
    By sienahoops in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-16-2013, 05:24 PM
  3. [SOLVED] Looping Through Sheets in a workbook in Excel 2010
    By Johnr1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2012, 05:09 AM
  4. [SOLVED] Copy All Visible Sheets To New Workbook Excluding Specific Sheets
    By ezrizer in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-19-2012, 02:19 PM
  5. VBA to Copy specific sheets from one workbook to another workbook
    By ultaabhi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-19-2012, 05:22 AM
  6. Copy sheets from different workbooks to specific sheets in one workbook
    By erikfae in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2011, 08:02 AM
  7. Looping through a workbook with sheets and charts
    By Masact in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2009, 05:59 PM
  8. Looping a column in workbook 1 to workbook 2's sheets
    By L. Howard Kittle in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-15-2006, 11:15 AM

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