When I import some txt files into excel, I have to clean up the gargbage. This is the part of my code for each file to filter and delete. It works in every other file, but in this particular file, it give me a message that the variable is not defined. I know that there are several different ways to define variables, and I am confused on which to use when. Can someone lend a hand?
Thanks bunches as always
marcia
Code:
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=" "
With Sheets("OCVCHK").AutoFilter.Range
On Error Resume Next
Set rngToDelete = .Offset(1).Resize(.Rows.Count - 1, .Columns.Count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Delete
Thanks bunches as always
marcia