Consulting

Results 1 to 3 of 3

Thread: Solved: Testing the sheetname

  1. #1
    VBAX Regular
    Joined
    Apr 2008
    Posts
    25
    Location

    Solved: Testing the sheetname

    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?

  2. #2
    VBAX Regular
    Joined
    Jan 2006
    Posts
    28
    Location

    Smile

    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

  3. #3
    VBAX Regular
    Joined
    Apr 2008
    Posts
    25
    Location
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •