Hi all,
I am trying to run a macro to delete all the "..." in my excel document. I have tried to do this two ways, both by looping, and with special cells. Depending on the data, this is taking upwards of an hour. Does anyone have any reccommendations on how I can improve this. The data, does vary in length.
Looping:
Sub ellipses()
Sheets("RawData").Select
Range("A1").Select
Dim i As Integer
For i = 1 To 2658
Cells.Find(What:="...", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(0, 1)).Select
Selection.Delete Shift:=xlToLeft
Next i
End Sub
Special Cells:
Sheets("RawData").Select
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=2, Criteria1:="..."
Columns("B:C").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=2
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=3, Criteria1:="..."
Columns("C:D").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=3
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=4, Criteria1:="..."
Columns("D:E").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=4
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=5, Criteria1:="..."
Columns("E:F").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=5
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=6, Criteria1:="..."
Columns("F:G").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=6
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=7, Criteria1:="..."
Columns("G:H").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=7
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=8, Criteria1:="..."
Columns("H:I").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=8
Cells.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft
I am trying to run a macro to delete all the "..." in my excel document. I have tried to do this two ways, both by looping, and with special cells. Depending on the data, this is taking upwards of an hour. Does anyone have any reccommendations on how I can improve this. The data, does vary in length.
Looping:
Sub ellipses()
Sheets("RawData").Select
Range("A1").Select
Dim i As Integer
For i = 1 To 2658
Cells.Find(What:="...", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(0, 1)).Select
Selection.Delete Shift:=xlToLeft
Next i
End Sub
Special Cells:
Sheets("RawData").Select
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=2, Criteria1:="..."
Columns("B:C").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=2
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=3, Criteria1:="..."
Columns("C:D").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=3
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=4, Criteria1:="..."
Columns("D:E").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=4
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=5, Criteria1:="..."
Columns("E:F").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=5
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=6, Criteria1:="..."
Columns("F:G").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=6
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=7, Criteria1:="..."
Columns("G:H").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=7
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=8, Criteria1:="..."
Columns("H:I").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$Y$21718").AutoFilter Field:=8
Cells.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft