PDA

View Full Version : Solved: Testing the sheetname



Jow
04-24-2008, 03:44 AM
I want to test the active sheetname to see if it contains a certain literal...Here's some 'pseudocode' that I was hoping would work, but it didn't.




If activesheet.name like *"Origan"* Then



So basically I want to see if the sheetname contains "origan" and if so, run some other code...

Or is there a better/easier way?

dominicb
04-24-2008, 04:05 AM
Good morning Jow

How about something like this :

MsgBox UCase(ActiveSheet.Name) Like UCase("*Origan*")

You don't actually need the UCase bits - they just remove the case sensitivity, if you wanted it.

HTH

DominicB

Jow
04-24-2008, 04:34 AM
I was trying to figure out why you're code worked and mine didn't since my file names are all propercase, then I realised, in my original code I put the speech marks inside the asterisk...so all is fine now.

Thanks!