Is my syntax wrong here?
Trim(Range(sRange).Text) Like Not "Page" Then
Is my syntax wrong here?
Trim(Range(sRange).Text) Like Not "Page" Then
sorry, heres my whole code. what am i missing?
If Trim(Range(sLeftRange).Text) <> UCase(Trim(Range(sLeftRange).Text)) AndTrim(Range(sRange).Text) Like Not "Page" ThenRange(sLeftRange).Interior.ColorIndex = iColour End If
changed to this, but still same problem....
If Trim(Range(sLeftRange).Text) <> UCase(Trim(Range(sLeftRange).Text)) And Not Trim(Range(sLeftRange).Text) Like "Page" Then Range(sLeftRange).Interior.ColorIndex = iColour End If
this is confusing
http://www.sunny-beach.net/manual/249.htm
Hi crmpicco,
Yes, your syntax is wrong, try this
Note that while 'like' can be used as shown above for an exact match, the 'like' atatement is usually used with a wild-card character to find similar words E.G. "*Page" will give "Front Page", "Last Page",...etc. OR, "Page*" will give "Page one", Page two", etc.Sub LikeItOrNot() Dim sRange sRange = "A1" If Not Trim(Range(sRange).Text) Like "Page" Then MsgBox "Not Page" Else MsgBox "Page" End If End Sub
HTH,
John
You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you
The major part of getting the right answer lies in asking the right question...
Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.
nice 1:
If Trim(Range(sLeftRange).Text) <> UCase(Trim(Range(sLeftRange).Text)) And Not Trim(Range(sLeftRange).Text) Like "*Page*" Then Range(sLeftRange).Interior.ColorIndex = iColour End If
Not a prob, glad to be able to help
You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you
The major part of getting the right answer lies in asking the right question...
Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.