Find value and delete then shift cells up

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,340
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.
 

Some videos you may like

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,680
Office Version
  1. 2010
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.
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,498
Messages
5,596,509
Members
414,073
Latest member
Contilly

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