select sheets by name - how?
Walt,
This is untested, but might work.
Just add a way to input mywsh (InputBox, ComboBox, ListBox, Drop Down, etc.)
Dim x as Integer, wsh as Integer, mywsh as String
mywsh = "July 05"
For x = 1 to ActiveWorkbook.Worksheets.Count
If Lcase(Sheets(x).Name) = Lcase(Left(mywsh,3)) then
Sheets(x).Select
Exit For
End If
Next
You could also use a Do .... While .... Loop
steve
"Walt" wrote in message
om...
Following problem:
There are some workbooks with 12 sheets each. these sheets are called:
"Jan 00", "Feb 00", ...,"Dec 00" or "Jan 03, ..., "Dec 03".
I know that I can refer to the 'internal' number of the sheets (1 to
12). But in my case I have to select the sheets by the
user-defined-name. The macro should exist over many years, so I can
only use part of the name = monthname.
I would like to have code like that:
If Sheets(Worksheets(x).Name).Name = "July 00" Then '(that works)
where the 00-part is variable!
Is there a possibility to refer only to a PART of the user defined
sheet name?
TIA Walt
|