Is it realy BAD?
I only have two in this macro... Is it acceptable to do it this way, or should I look at a difference code flow?
TX
Code: Select all
Private Sub CleanData()
Dim lLR As Long
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name <> "Report" Then
lLR = ws.Range("A1000000").End(xlUp).Row
If lLR = 5 Then GoTo wsDel
ws.Columns("A:A").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ws.Range("A6:A" & lLR).FormulaR1C1 = _
"=IF(OR(ISNUMBER(RC[1]),IFERROR(SEARCH(""-"",RC[1]),0)>0,LEN(RC[1])=2),NA())"
ws.Range("A6:A" & lLR).SpecialCells(xlCellTypeFormulas, 16).EntireRow.Delete
ws.Columns("I:K").ColumnWidth = 15
ws.Range("A1").EntireColumn.Delete
wsNext:
End If
Next ws
Exit Sub
wsDel:
Application.DisplayAlerts = False
ws.Delete
Application.DisplayAlerts = True
GoTo wsNext
End Sub