teatimecrumpet
Active Member
- Joined
- Jun 23, 2010
- Messages
- 307
Hi,
I'm using the code below to loop through some sheets to do some formatting and copy/pasting to a new sheet. My question is: How can I modify it to ignore sheets if they have a particular string in a particular cell. Can I run another loop to change a sheet's name if it contains the string then modify the below to avoid sheets beginning with the new name (i.e. add an "N" to the begining of the sheet name if it has the cell string)?
Thanks in advance,
I'm using the code below to loop through some sheets to do some formatting and copy/pasting to a new sheet. My question is: How can I modify it to ignore sheets if they have a particular string in a particular cell. Can I run another loop to change a sheet's name if it contains the string then modify the below to avoid sheets beginning with the new name (i.e. add an "N" to the begining of the sheet name if it has the cell string)?
Thanks in advance,
Dim WB As Workbook
Dim WS As Worksheet
Dim AW As String
AW = ActiveWorkbook.Path
Set WB = ActiveWorkbook
For Each WS In WB.Worksheets
Select Case LCase(WS.Name)
'Sheet names to exclude from export.
Case Is = "Blue", "Green", "Yellow"
Case Else
'formatting and pasting
End Select
Next WS