Delete matched string from sheet

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,602
Office Version
  1. 365
Platform
  1. Windows
Hey all

I have a text string in cell A3 of workings sheet

Can you help with VB that will search for an exact match to this text string through column B of the stock sheet.
Once found (there should always be an exact match) then delete cells in that row, columns B:O.
Once these cells deleted, shift all the rows below up one to fill these blank cells.

Note, I don't want entire row deleted or entire rows below moved up to fill void because I have important information populating column A of the stock sheet that can't be altered.
also Note that the text string used can also include numbers, but NOT just numbers, eg, There are 33 red balls, or 126 small bags
Hope this makes sense and thanks in advance
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try
VBA Code:
Sub FindAndDelete()
  Sheets("stock").Columns("B").Find(What:=Sheets("workings").Range("A3").Value, LookAt:=xlWhole).Resize(, 14).Delete Shift:=xlUp
End Sub
 
Upvote 1
Solution
Try
VBA Code:
Sub FindAndDelete()
  Sheets("stock").Columns("B").Find(What:=Sheets("workings").Range("A3").Value, LookAt:=xlWhole).Resize(, 14).Delete Shift:=xlUp
End Sub
Perfect - thanks a lot
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,124
Messages
6,123,184
Members
449,090
Latest member
bes000

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