Hi there,
I'm trying to edit a macro I originally recorded that ended up being about 3000 lines, about 2000 of which are "ActiveWindow.ScrollColumn = x". These "ActiveWindow.ScrollColumn = x" are the lines I'm trying to remove to ultimately clean up the original script. So, I copied and pasted the lines of code into an Excel spreadsheet in an effort to write some more code to loop through these cells and delete the scrolling lines.
My sub looks like this:
''Deleting Scrolls Script
Sub deleteScrolls()
Dim i As Integer
For i = 1 To Range(Range("A1"), Range("A1").End(xlDown)).Rows.Count
If Cells(i, 1).Value Like "ActiveWindow.ScrollColumn" Then
Rows(ActiveCell.Row).Select
Selection.Delete Shift:=xlUp
End If
Next i
End Sub
I also tried a slightly different version of the code:
'test 2
Sub deleteScrolls()
Dim i As Integer
For i = 1 To Range(Range("A1"), Range("A1").End(xlDown)).Rows.Count
If ActiveCell.Value Like "*ActiveWindow.ScrollColumn*" Then
Rows(ActiveCell.Row).Select
Selection.Delete Shift:=xlUp
End If
Next i
End Sub
So I'm trying to loop through and delete any lines that have the value of the ActiveWindow.ScrollColumn using the Like command. I'm assuming this part is where the code is falling short.
I have attached a screenshot of the Excel doc with an example of the lines I'm trying to delete.
Any help would be greatly appreciated.
Bookmarks