View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1824_] Rick Rothstein \(MVP - VB\)[_1824_] is offline
external usenet poster
 
Posts: 1
Default 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