VBA deleted rows

Ks1102

Well-known Member
Joined
Jan 8, 2008
Messages
685
Hi all

I looking help the VBA code for deleting rows when the cells F3 to down if the value = C then rows deleted,


please help
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

mvptomlinson

Well-known Member
Joined
Mar 10, 2008
Messages
2,638
Hi KS1102, perhaps:
Code:
Sub deleteRows()
Dim i as Long
For i = Range("F" & Rows.Count).End(xlUp).Row To 3 Step -1
    If Cells(i, "F").Value = "C" Then Cells(i, "F").EntireRow.Delete
Next i
End Sub
 

Ks1102

Well-known Member
Joined
Jan 8, 2008
Messages
685
Hi KS1102, perhaps:
Code:
Sub deleteRows()
Dim i as Long
For i = Range("F" & Rows.Count).End(xlUp).Row To 3 Step -1
    If Cells(i, "F").Value = "C" Then Cells(i, "F").EntireRow.Delete
Next i
End Sub

Thanks .....perfectly
 

Bill Rockenbach

Well-known Member
Joined
May 4, 2009
Messages
1,412
If you have many rows to delete this code may run faster

Code:
Sub DeleteRows()
    Dim c As Range
    Dim rng As Range
    For Each c In Range("F3", Range("F65536").End(xlUp))
        If c = "C" Then
            If rng Is Nothing Then
                Set rng = c
            Else
                Set rng = Union(rng, c)
            End If
        End If
    Next c
    If Not rng Is Nothing Then rng.EntireRow.Delete
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,519
Messages
5,596,635
Members
414,083
Latest member
Mrsash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top