ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Like Function (https://www.excelbanter.com/excel-programming/335471-like-function.html)

Nigel

Like Function
 
One of those days today,

I am using the following if statement in some code

If Not .Name = "Menu" And Not .Name = "Login" And Not .Name = "Report" And
Not .Name = "Report 2" And Not .Name Like "Daily" Then

do something

end if

It will ignore the sheets named except the Daily one. What I am trying to
accomplish is for the code to not run on any spreadsheet with the word Daily
at the begining of it name plus the other name sheets

Thanks

Norman Jones

Like Function
 
Hi Nigel,

Try:

Like "Daily*"


---
Regards,
Norman



"Nigel" wrote in message
...
One of those days today,

I am using the following if statement in some code

If Not .Name = "Menu" And Not .Name = "Login" And Not .Name = "Report" And
Not .Name = "Report 2" And Not .Name Like "Daily" Then

do something

end if

It will ignore the sheets named except the Daily one. What I am trying to
accomplish is for the code to not run on any spreadsheet with the word
Daily
at the begining of it name plus the other name sheets

Thanks




Tom Ogilvy

Like Function
 
Not .Name Like "Daily*" Then

--
Regards,
Tom Ogilvy


"Nigel" wrote in message
...
One of those days today,

I am using the following if statement in some code

If Not .Name = "Menu" And Not .Name = "Login" And Not .Name = "Report" And
Not .Name = "Report 2" And Not .Name Like "Daily" Then

do something

end if

It will ignore the sheets named except the Daily one. What I am trying to
accomplish is for the code to not run on any spreadsheet with the word

Daily
at the begining of it name plus the other name sheets

Thanks




Héctor Miguel

Like Function
 
hi, Nigel !

... the following if statement in some code
If Not .Name = "Menu" And Not .Name = "Login" And Not .Name = "Report" And
Not .Name = "Report 2" And Not .Name Like "Daily" Then
do something
end if
It will ignore the sheets named except the Daily one... trying to accomplish
... code to not run on any spreadsheet with the word Daily at the begining of it name plus the other name sheets


maybe an alternate approach ?
If InStr(1, .Name, "daily", vbTextCompare) = 0 Then
Select Case Application.Trim(LCase(.Name))
Case "menu", "login", "report", "report 2"
' do nothing
Case Else
' do something
End Select
End If

hth,
hector.




All times are GMT +1. The time now is 11:17 AM.

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