Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count and List only WorkSheets named (anything)&"-pilot"

I need help with the following code to count and list only worksheets
that contain the name "(anything)&-Pilot". I have code that installs
the worksheet and names it, but I can't get a list of sheets with
"(anything)&-Pilot".
TIA for any help,
Doug

Present code:

Private Sub CountPilots()
Dim Plt As Long
'count only worksheets named (anything)-Pilot
With ActiveWorkbook.Worksheets(Array("" & "," & "pilot", "" &
"-pilot", "" & "- pilot"))
Worksheets(Array("" & "," & "pilot", "" & "-pilot", "" & "-
pilot")).Count = Plt
End With
'Place name of all worksheets named (anything)-pilot on activesheet
or "Name-List" sheet
For Plt = 1 To Worksheets.Count
ActiveCell(Plt, 1).Value = Worksheets(Plt).Name
Next Plt
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count and List only WorkSheets named (anything)&"-pilot"



Dim rng as Range
Dim icnt as Long
set rng = ActiveCell
for each sh in ThisWorkbook.Worksheets
if instr(1,sh.name, "-pilot",1) then
rng.offset(icnt,0).Value = sh.name
icnt = icnt + 1
end if
Next


If you will accept just "anything" & "pilot" without the hyphen, then change
to

Dim rng as Range
Dim icnt as Long
set rng = ActiveCell
for each sh in ThisWorkbook.Worksheets
if instr(1,sh.name, "pilot",1) then
rng.offset(icnt,0).Value = sh.name
icnt = icnt + 1
end if
Next
--
Regards,
Tom Ogilvy


"Doug" wrote in message
om...
I need help with the following code to count and list only worksheets
that contain the name "(anything)&-Pilot". I have code that installs
the worksheet and names it, but I can't get a list of sheets with
"(anything)&-Pilot".
TIA for any help,
Doug

Present code:

Private Sub CountPilots()
Dim Plt As Long
'count only worksheets named (anything)-Pilot
With ActiveWorkbook.Worksheets(Array("" & "," & "pilot", "" &
"-pilot", "" & "- pilot"))
Worksheets(Array("" & "," & "pilot", "" & "-pilot", "" & "-
pilot")).Count = Plt
End With
'Place name of all worksheets named (anything)-pilot on activesheet
or "Name-List" sheet
For Plt = 1 To Worksheets.Count
ActiveCell(Plt, 1).Value = Worksheets(Plt).Name
Next Plt
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Pivot Table Data with Column "Sum" rather than "count" defa Johnny_99[_2_] Excel Discussion (Misc queries) 2 January 2nd 10 03:25 PM
"Count" and "List" functions across sheets Meg Excel Worksheet Functions 0 October 14th 08 02:11 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
how can I count if column A="active" and column E="Job" in a list? Brandoni Excel Worksheet Functions 1 October 14th 06 09:09 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 03:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"