ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checking for text in Sheet Name (https://www.excelbanter.com/excel-programming/368525-checking-text-sheet-name.html)

Barb Reinhardt

Checking for text in Sheet Name
 
I am wanting to check for a specific grouping of text in the sheet name using
something similar to the SEARCH function. Let's say, for example, I want to
find if "1" is present in the sheet name. How would I code that?

Thanks,
Barb Reinhardt

Die_Another_Day

Checking for text in Sheet Name
 
If InStr(1,ActiveSheet.Name,"1") 0 Then
'1 is in the name
Else
'1 is not in the name
End If

HTH

Die_Another_Day

Barb Reinhardt wrote:
I am wanting to check for a specific grouping of text in the sheet name using
something similar to the SEARCH function. Let's say, for example, I want to
find if "1" is present in the sheet name. How would I code that?

Thanks,
Barb Reinhardt



Dave Peterson

Checking for text in Sheet Name
 
Check out VBA's InStr().



Barb Reinhardt wrote:

I am wanting to check for a specific grouping of text in the sheet name using
something similar to the SEARCH function. Let's say, for example, I want to
find if "1" is present in the sheet name. How would I code that?

Thanks,
Barb Reinhardt


--

Dave Peterson

Stefi

Checking for text in Sheet Name
 
Hi Barb,

x = InStr(1, ActiveSheet.Name, "1")
gives you the place of "1" in sheet name or 0 if "1" is not present.

Regards,
Stefi

€˛Barb Reinhardt€¯ ezt Ć*rta:

I am wanting to check for a specific grouping of text in the sheet name using
something similar to the SEARCH function. Let's say, for example, I want to
find if "1" is present in the sheet name. How would I code that?

Thanks,
Barb Reinhardt



All times are GMT +1. The time now is 02:46 PM.

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