Try Select Caseinstead, with several scenarios Ifand Elseit is much easier to use and read.
Select Case MonCol
Case 12, 13, 14
' do nothing
Case Else
.Range(.Cells(1, lastcol - 1), .Cells(1, MonCol + 1)).EntireColumn.Delete
.Range(.Cells(1, DataType + 1), .Cells(1, MonCol - 4)).EntireColumn.Delete
End Select
Change 1 . Following @Rory's comments, you can also use Case 12 To 14, this can come in handy, especially for ranges with a lot of values, then you can use Case 12 To 30, etc.
source
share