Link two columns then exclude rows in one column

richard12

New Member
Joined
Feb 9, 2017
Messages
23
I have 2 sheets in the same workbook where I need to exclude/delete rows in one sheet when the values are not found in the second sheet. The two sheets are imported from downloaded workbooks. The result is a workbook that has two sheets where Sheet1 may have rows that need to be deleted.

Example:

Sheet1 (where rows may be deleted) has unique values, such as organization codes, in column A: 91, 92, 93, 94, 95, 96, 97, 98
Sheet2 (where values are the same as Sheet1) has multiple values, such as employees, in Column F: 91, 91, 93, 93, 94, 91, 95, 94, 91, 93, 97, 98

The Sheet1 rows to be deleted, organization codes of employees who left, would be 92, and 96.

I'm not sure how to connect these two columns and/or how to proceed to delete, or mark rows for later deletion, in Sheet1.

I'd to do this in VBA as part of a Macro process.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I've found I can use Match and VLookup for most of the rows. Now my problem is some values do not match when they should. The values are the result of a macro copy/paste where I get the first 8 characters of a cell using (left(a1,8) which appears to work, I can see the result and it looks correct. However when I match or lookup the other table, some formulas work and some do not. Yet when I keyboard over the same values that do not match up, the typed values are always found and result in the correct reply.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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