SomethngWicked
Board Regular
- Joined
- Feb 18, 2015
- Messages
- 80
Hi All -
I have a CF macro that I'm applying to 20+ worksheets within a workbook. However, there are two worksheets that don't contain the same formatted data and I need to run a modified version of the CF statement to these two worksheets. Initially, I just wrote two elseif statements and this appears to work on the first worksheet, but does not seem to be applying to the second. Can someone please tell me where the train is coming off the tracks? I've reviewed some elseif literature online and I can't seem to find the issue. Below is some of my code. Thanks!
I have a CF macro that I'm applying to 20+ worksheets within a workbook. However, there are two worksheets that don't contain the same formatted data and I need to run a modified version of the CF statement to these two worksheets. Initially, I just wrote two elseif statements and this appears to work on the first worksheet, but does not seem to be applying to the second. Can someone please tell me where the train is coming off the tracks? I've reviewed some elseif literature online and I can't seem to find the issue. Below is some of my code. Thanks!
Code:
Sub RunCF()
Dim xsheet As Worksheet
For Each xsheet In ThisWorkbook.Worksheets
If xsheet.Name <> ("Mast") And xsheet.Name <> ("SR1") And xsheet.Name <> ("SR2") Then
xsheet.Select
Range("A2:R100").Select
'CF STATEMENT IS HERE'
End With
ElseIf Sheets("SR1").Select Then
Range("A2:J100").Select
'CF STATEMENT IS HERE'
End With
ElseIf Sheets("SR2").Select Then
Range("A2:J100").Select
'CF STATEMENT IS HERE'
End With
End If
Next xsheet
End Sub