Results 1 to 5 of 5

Subset of worksheets

Threaded View

  1. #1
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Subset of worksheets

    I have a workbook with lots of sheets, I'm only interested in a subset of sheet names. These I entered into a worksheet called MacroInfo in the same workbook. I want to loop through each worksheet and if it's name is one of the subset then do something.

    I have this code for a fixed set of sheet names
    Dim ws As Worksheet
    Dim thisWB As Workbook
    Set thisWB = ThisWorkbook
    
    For Each ws In thisWB.Worksheets
            Select Case (ws.Name)
                ' Only interested in searching worksheets with these names
                Case "GPT", "Portables", "Fixed systems", "I&C", "Probes and Cables", "Retro Bundles", "Software", "Parts & Svc"
                    'Do something
           End Select
    Next ws
    Now, trying to get the sheet names dynamically from the MacroInfo worksheet

    Dim sheetNames As Variant
    
    sheetNames = thisWB.Worksheets("MacroInfo").Range("G1:G" & thisWB.Worksheets("MacroInfo").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row).Value
        For i = LBound(sheetNames) To UBound(sheetNames)
             Debug.Print sheetNames(i)
        Next i
    But I get nothing. Even when I hard code the range to "G1:G8"

    Any ideas what I'm doing wrong?

    Thanks
    Last edited by jlt199; 07-29-2013 at 03:45 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Subset Sum Problem
    By smuzoen in forum Excel Tips
    Replies: 0
    Last Post: 07-05-2012, 09:55 AM
  2. Max value from column subset?
    By Carolina in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-16-2011, 08:51 AM
  3. Saving subset of Worksheets
    By rtiltins in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2008, 04:25 PM
  4. MAX Value of Column Subset
    By WeatherGuy in forum Excel General
    Replies: 5
    Last Post: 04-19-2007, 04:36 PM
  5. How to enter symbols for subset or element of a subset in Excel?
    By rwcita in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-23-2006, 05:30 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