Delete Rows based upon text values in a column

fari1

Active Member
Joined
May 29, 2011
Messages
362
hi experts,

i've a column A in sheet1, each cell of the column contains a text value, what i want is to have a code, that will run in sheet 2 and delete those rows, which contain text value from any cell of column A of sheet1.
say e.g i've in column A the values as below

Mango
Apple
Bnanana


and if any of the above value appears in any row of sheet 2, just simply delete that row and leave the rest and it shouldn't be case sensetive.

thanking u in advance
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Sub deletein()
StartRow = 2
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
With Application
CurrentScreenUpdating = .ScreenUpdating
CurrentCalculate = .Calculation
CurrentEnableEvents = .EnableEvents
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
End With
For X = LastRow To StartRow Step -1
If Cells(X, "A").Value Like "*in*" Then Cells(X, "A").EntireRow.Delete
Next
With Application
.ScreenUpdating = CurrentScreenUpdating
.Calculation = CurrentCalculate
.EnableEvents = CurrentEnableEvents
End With
End Sub


i've the above code, instead of specific word, i want to define column A, whatever is in column A of sheet1, i want the code to read those values and delete whatever rows it finds.


plz anyone
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

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