If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Get a count of related worksheets

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-05, 05:38
cruickshanks cruickshanks is offline
Registered User
 
Join Date: Jul 2004
Location: Inverurie
Posts: 628
Get a count of related worksheets

Hi all,

Does anyone know how to get a count of all worksheets that have a common text element i.e. (GT11)?

This is in order to maintain an accurate count of pages in a specific section of a massive workbook.

Cheers.
Reply With Quote
  #2 (permalink)  
Old 03-10-05, 12:05
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
how about this

Code:
Sub CountSpecific()
    Dim wks As Worksheet
    Dim i As Integer
    
    i = 0
    For Each wks In ThisWorkbook.Worksheets
        If wks.Name Like "Sheet*" Then
            i = i + 1
        End If
    Next wks
    
    MsgBox i
End Sub
for example
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On