Hey,
So I am relatively new to VBA and am having some issues. What I am currently trying to do is to remove or clear a row that has been formatted with strikethrough. My list must remain at 1000 rows with the same formatting (color, size etc). One way I have been going about this is clearing the contents of the row, then cutting and pasting at the end of how ever long my current list is (somewhere within 1000). This is the code I am using so far:
Note: As I am implementing this over several worksheets I am stepping through all the tabs and this is what checkTab is. And I am starting at 18 as that is where my data starts (all headings above).
' Finding the last row with entered data
lastLine = Sheets(checkTab).Range("G1000").End(xlUp).Row
For counter2 = lastLine To 18 Step -1
If Sheets(checkTab).Rows(counter2).Font.Strikethrough = True Then
'I only want to clear a certain range in the row
Sheets(checkTab).Range("A" & counter2, "AT" & counter2).ClearContents
Sheets(checkTab).Rows(counter2).Select
Selection.Cut
Selection.Rows(lastLine+1).Select
Selection.Insert Shift:=xlDown
End If
Next
For some reason which I cannot understand...I am getting fully blank lines with the formatting removed. I have tried recording a macro cutting and copying to see what it did but that wasn't much help.
Any help would be greatly appreciated
So I am relatively new to VBA and am having some issues. What I am currently trying to do is to remove or clear a row that has been formatted with strikethrough. My list must remain at 1000 rows with the same formatting (color, size etc). One way I have been going about this is clearing the contents of the row, then cutting and pasting at the end of how ever long my current list is (somewhere within 1000). This is the code I am using so far:
Note: As I am implementing this over several worksheets I am stepping through all the tabs and this is what checkTab is. And I am starting at 18 as that is where my data starts (all headings above).
' Finding the last row with entered data
lastLine = Sheets(checkTab).Range("G1000").End(xlUp).Row
For counter2 = lastLine To 18 Step -1
If Sheets(checkTab).Rows(counter2).Font.Strikethrough = True Then
'I only want to clear a certain range in the row
Sheets(checkTab).Range("A" & counter2, "AT" & counter2).ClearContents
Sheets(checkTab).Rows(counter2).Select
Selection.Cut
Selection.Rows(lastLine+1).Select
Selection.Insert Shift:=xlDown
End If
Next
For some reason which I cannot understand...I am getting fully blank lines with the formatting removed. I have tried recording a macro cutting and copying to see what it did but that wasn't much help.
Any help would be greatly appreciated