VBA delete all row after row

Jeeremy7

Board Regular
Joined
May 13, 2020
Messages
63
Office Version
  1. 365
Platform
  1. Windows
Hello,

I was wondering what was the code for deleting all row values after the macro sees a certain text in column A ?

Thanks !
 

Some videos you may like

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,084
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Sub jeeremy()
   Dim Fnd As Range
   
   Set Fnd = Range("A:A").Find("something", , , xlWhole, , , False, , False)
   If Fnd Is Nothing Then Exit Sub
   Range(Fnd.Offset(1), Cells(Rows.Count, 1)).EntireRow.Delete
End Sub
 

Jeeremy7

Board Regular
Joined
May 13, 2020
Messages
63
Office Version
  1. 365
Platform
  1. Windows
THANKS !

Fluff for the win like always hehe
Can I delete the "something" row on the same code ?

Also what are those DIM "" AS "" is that like a rule ?

Thanks again Fluff .. I might post something else again today :p
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,084
Office Version
  1. 365
Platform
  1. Windows
To delete the found row use
VBA Code:
Range(Fnd, Cells(Rows.Count, 1)).EntireRow.Delete
DIM statements are a way of declaring variables.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,084
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,867
Messages
5,598,542
Members
414,245
Latest member
allyciv

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