Deleting Rows on condition

Joined
Oct 1, 2009
Messages
1
Reaction score
0
Hello,

I have to make a macro that will delete all Rows which contains at least one Cell with StrikeThrough format.

Here is what I made so far :

Code:
Dim r As Range
Dim s As Worksheet
Dim c As Range
Dim i As Long

    For Each s In ActiveWorkbook.Worksheets
        s.Activate
        Set r = s.UsedRange
        For Each c In r.Cells
            If c.Characters.Font.Strikethrough Then
                Rows(c.Row).Select
                Selection.Delete Shift:=xlUp
            End If
        Next c
    Next s

It's not working yet as intended. Lets say the macro finds it has to delete a row when checking the Cell 5I, it will delete the row I which is good, but the next cell it will wheck will be 5J, whereas it should start checking the new row from the start (5A).

If you could help me, I would really appreciate.

Thanks
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top