Delete row based on cell value

288enzo

Well-known Member
Joined
Feb 8, 2009
Messages
721
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I'm not using a table.

I would like to search column A for a specific value. I would like to delete the row where the specific value is found in column A and shift all rows up 1.

Please let me know if more info is needed. In my mind it seems fairly simple, but then again nothing is truly simple. :)

Thank you,
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
@cmowla you would be better off preventing an error if the matched values is not found, rather than a general error handler that could be triggered by any number of things. Especially when you give no warning that an error occurred.

Also whilst you "bang-on" about the "dangers" of using Range.Find, without specifying all parameters, your code in post#10 does not specify all parameters. :unsure:
 
Upvote 0
@cmowla you would be better off preventing an error if the matched values is not found, rather than a general error handler that could be triggered by any number of things. Especially when you give no warning that an error occurred.
Is the other type of error that can occur due to merged cells causing an error with row deletion or protected sheet? (I don't see what other error could result from Worksheet.Match except for if a match isn't found is what I'm getting at, and if an error occurs.)

Also whilst you "bang-on" about the "dangers" of using Range.Find, without specifying all parameters, your code in post#10 does not specify all parameters. :unsure:
You're correct. I made an edit at the end of the post at the last of the 10 minute window saying that I should have at least allow you to pass an argument for search by value or search by formula. (I don't really know if MatchByte is that important.) But again, yeah, you're correct! :)
 
Upvote 0
Is the other type of error that can occur due to merged cells causing an error with row deletion or protected sheet?
Amongst other things. You would also get an error if there is a table on the sheet that intersects with the row being deleted.

You're correct. I made an edit at the end of the post at the last of the 10 minute window saying that I should have at least allow you to pass an argument for search by value or search by formula.
You also don't specify the find format.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,694
Members
448,979
Latest member
DET4492

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