LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Count worksheets begining with certain text

Oh Wise Ones,
I did some searching and found some code that
counts worksheets with a particular name. I need something similar but I
need to place the count in a cell on a sheet named "Control". How would I
count the number of sheets that start with AC and place the number in cell A1
and count the number of sheets that start with NM and place them in cell A2.
As sheets are added the numbers would increment. The last part of the code
adds worksheets which I don't want to do programatically, but looks like it
would preclude code to insert the count to a cell, so I left it Please
advise.

Many Thanks,
Mike

Private Sub worksheetMaker()
Dim WB As Workbook
Dim SH As Worksheet
Dim i As Long
Dim iCtr As Long
Const sName As String = "Report"

For i = 1 To ThisWorkbook.Worksheets.Count
If Worksheets(i).Name Like sName & "*" Then
iCtr = iCtr + 1
End If
Next i
'
'If iCtr = 0 Then iCtr = 1
Set SH = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
SH.Name = sName & iCtr + 1
End Sub
 
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
how to Add Data & Text to begining of All Cells sarwota Excel Discussion (Misc queries) 1 March 10th 09 07:26 PM
How to keep zeros at the begining of a number sockst Excel Worksheet Functions 2 November 5th 08 12:42 PM
Count Text within Multiple Worksheets Laffin Excel Worksheet Functions 10 June 5th 07 01:56 PM
Add text to begining of cells within a range based on specified criteria jsd219 Excel Discussion (Misc queries) 5 October 20th 06 03:59 PM
select text in cell based on text from another cell, paste the text at the begining of a thrid cell, etc... jsd219 Excel Programming 0 October 19th 06 05:04 PM


All times are GMT +1. The time now is 05:07 AM.

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

About Us

"It's about Microsoft Excel"