Checking for text in Sheet Name

G

Guest

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
 
D

Die_Another_Day

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
 
D

Dave Peterson

Check out VBA's InStr().



Barb said:
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
 
G

Guest

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top