Hi All,
I am running a macro loop on several worksheets in a workbook and it works, but I would like to exclude worksheets that have "14" or "15" in their name (for example Jan14, Feb14, Jan15). How can I do this? The code below doesn`t work, the loop still runs on those worksheets with "14" or "15" in their name.
(I have just put the code I am looping as "`loop Code" as that works fine, no need to look into it.)
Could someone help me with this? Cheers, A.
Sub KincM10WorksheetLoop()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If InStr(ws.Name, "*14") = 0 Or InStr(ws.Name, "*15")=0 Then
ws.Activate
` loop Code
End If
Next ws
End Sub
Bookmarks