Delteing data in Col A if "ABC" found in Col B

rthorne

New Member
Joined
Oct 7, 2010
Messages
17
I need to look for "ABC" in col B and if found, delete cell data for that row in Col A.

Can you assist in how to do this. I have over 20K rows to review and would like a systemic way to accomplaish this.

thanks in advance

RT
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Give this a go:

Code:
Public Sub ClearA()
Dim i As Long, LR As Long
LR = Range("B" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For i = 1 To LR
   If Range("B" & i).Value = "ABC" Then
      Range("A" & i).ClearContents
   End If
Next i
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Press ALT + F11 to open the Visual Basic Editor, select Module from the Insert menu and paste into the white space on the right

Code:
Sub NoABC()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    If Range("B" & i).Value Like "*ABC*" Then Range("A" & i).ClearContents
Next i
End Sub

Press ALT + Q to close the code window, press ALT + F8, click on NoABC then click the Run button.
 
Upvote 0
Thank you for such a quick and accurate response. the VB code worked just fine.

Happy Friday!!!!
 
Upvote 0

Forum statistics

Threads
1,214,426
Messages
6,119,411
Members
448,894
Latest member
spenstar

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