Delete Rows below word

JCtheEUC

Board Regular
Joined
Jul 17, 2008
Messages
50
I have a large table that contains a lot of unnessary data. I have a known point to which I need everything below that point and including that point deleted.

Example>
A 321321321321321
B 123123121231231
C 456465464564645
D 987987987987987

What I need is a macro that once it finds "C" it will delete that row and everything below it.

I hope you can help.
 

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).
Hello,

probably a few ways to do this

Code:
Sub delete_below_c()
    Range("A1").Select
    Do Until ActiveCell.Value = "c"
    Selection.Offset(1, 0).Select
    Loop
    Rows(ActiveCell.Row & ":65536").Delete
End Sub

assume it is searching down col A.
 
Upvote 0
Assuming that your 'C' is in column A: Try the following, hope this helps

Sub Test()
Columns("A:A").Find(What:="C", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select
Range(Selection, Selection.End(xlDown)).Delete Shift:=xlUp

End Sub
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,268
Members
448,558
Latest member
aivin

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
Back
Top