ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   name prefix for DA (https://www.excelbanter.com/excel-programming/410141-re-name-prefix-da.html)

Rick Rothstein \(MVP - VB\)[_1824_]

name prefix for DA
 
And yet one more possibility...

Sub Test()
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
If wks.Visible And InStr(1, "*IS-*BS-*CV-*CAS*EXE*", _
"*" & Left(wks.Name, 3) & "*", vbTextCompare) 0 Then
'
' Your code goes here
'
End If
Next
End Sub

Rick


"Dean" wrote in message
...
I have an if, then loop that has a condition that, if a sheet in the
workbook is visible, then do some things. It uses a "wks", such as if
wks.visible = true, then

wks.protect. If not, then move along to the next wks, and that sort of
thing.

I want to add another condition beyond it being visible Specifically, if
the worksheet's name's first 3 characters are NOT one of the following
five choices, then I also want to skip the operations.

IS-
BS-
CV-
CAS
EXE

Can someone tell me that syntax, please?

Thanks!
Dean






All times are GMT +1. The time now is 04:22 AM.

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