ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   activesheet.name ending in "-" &Style1 (https://www.excelbanter.com/excel-programming/443741-activesheet-name-ending-style1.html)

Wally

activesheet.name ending in "-" &Style1
 
I'm trying to find all sheets that end in "-" & Style1

If ActiveSheet.Name Like "??-" & Style1 Then
If ActiveSheet.Name Like "???-" & Style1 Then
If ActiveSheet.Name Like "????-" & Style1 Then

The sheetname could begin with 2 to 4 letters and always ends in - and
Style1 (another series of characters)
Style1 is 1-3 characters long.

TIA
Gerry


Don Guillett Excel MVP

activesheet.name ending in "-" &Style1
 
On Oct 12, 3:49*pm, Wally wrote:
I'm trying to find all sheets that end in "-" & Style1

If ActiveSheet.Name Like "??-" & Style1 Then
If ActiveSheet.Name Like "???-" & Style1 Then
If ActiveSheet.Name Like "????-" & Style1 Then

The sheetname could begin with 2 to 4 letters and always ends in - and
Style1 (another series of characters)
Style1 is 1-3 characters long.

TIA
Gerry


Sub findsheet()
For i = 1 To Sheets.Count
If InStr(LCase(Sheets(i).Name), "style") Then MsgBox i
Next i
End Sub

Wally

activesheet.name ending in "-" &Style1
 
On Oct 12, 5:13*pm, Don Guillett Excel MVP
wrote:
On Oct 12, 3:49*pm, Wally wrote:

I'm trying to find all sheets that end in "-" & Style1


If ActiveSheet.Name Like "??-" & Style1 Then
If ActiveSheet.Name Like "???-" & Style1 Then
If ActiveSheet.Name Like "????-" & Style1 Then


The sheetname could begin with 2 to 4 letters and always ends in - and
Style1 (another series of characters)
Style1 is 1-3 characters long.


TIA
Gerry


Sub findsheet()
For i = 1 To Sheets.Count
*If InStr(LCase(Sheets(i).Name), "style") Then MsgBox i
Next i
End Sub


Thanks Don

That worked for most but I have one Style that is only N, so when I
have it look for -N it also finds -NSH, -N72, etc.

Can I have it find the pages ending in -N?

Thanks

Gerry


All times are GMT +1. The time now is 04:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com