Find value and delete then shift cells up

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,404
Office Version
  1. 2016
Platform
  1. Windows
Can someone please show me how to find a value in a range, (in this case E2:E20), and delete the value then shift the cells below it up?

I want to avoid deleting the whole row because the is other data within the sheet, and for these purposes the value to be found will be a textbox value on a userform.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Can someone please show me how to find a value in a range, (in this case E2:E20), and delete the value then shift the cells below it up?

I want to avoid deleting the whole row because the is other data within the sheet, and for these purposes the value to be found will be a textbox value on a userform.
This line of code in whatever UserForm event procedure you are using to execute it will find and delete the value contained in a textbox named TextBox1 from the indicated range...

Range("E2:E20").Find(TextBox1.Value, , xlValues, xlWhole, , ,False).Delete xlShiftUp

Note that I used xlWhole meaning the value being searched for will be the only text in the cell containing it; however, if that text could be in the cell along with other text, then you would need to change it to xlPart.
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,377
Members
448,888
Latest member
Arle8907

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