Find match in list if match skip no match delete row

justvba

New Member
Joined
Jan 6, 2017
Messages
41
Hi I have a large list of parts that has duplicates and that's OK but I need to look at the part numbers on sheet2 and see if it is in sheet1. if in sheet one leave it alone if not in sheet 1 delete row. is there a fast way of doing this I am using 2016 excel VBA. here is my current code



Do Until IsEmpty(ActiveCell)
SearchItem = UCase(Trim(ActiveCell.Text))
OriginalSheet.Select
Range("A14").Select
Do Until ActiveCell.Value = SearchItem Or IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop

If ActiveCell.Value = SearchItem Then
If IsEmpty(ActiveCell.Offset(0, 4)) Then
Sheets("Current Price").Select
ActiveCell.Offset(1, 0).Select
Else
Sheets("Current Price").Select
ActiveCell.EntireRow.Delete
End If

Else
Sheets("Current Price").Select
ActiveCell.EntireRow.Delete
End If

Loop
 
Last edited:
justvba,

A question:

If Sheet1 looks like this:


Excel 2007
AB
1
2
3
4
5
6
7
8
9
10
11
12
13
14tire
15
16hoodk
17door
18shoe5
19shirt34 green
20toys
218
22
Sheet1



And sheet Current Price looks like this to start:


Excel 2007
A
1
2tire
3hood
4apples
5grapes
6orange
7red
8shorts
9toys
10toys
11tire
12shoe
13computer
14computer
15soda
16
Current Price


And sheet Current Price looks like these results:


Excel 2007
A
1tire
2door
3shoe5
4toys
5
Current Price


What is your logic for the Yellow cell A3 results = shoe5 ?
 
Last edited:
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
justvba,

I have tried several different methods to solve your request, but, I have not been able to get the results that you are looking for.

Maybe someone else on MrExcel will be able to help you.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,823
Members
449,470
Latest member
Subhash Chand

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