Clear contents based on contents in another sheet

n3wpv

New Member
Joined
Jun 24, 2015
Messages
18
Hello everyone. New VBA user here and in need of some help. I have a workbook with two sheets, “Max Data” and “Min Data”. Both sheets have the same number of columns with data in columns A and B being the same. Columns C and on have unique values.

Part NumberSerial NumberDataData
1XXXX-1XXXXXX
2XXXX-2XXXXXX
3XXXX-3XXXXXX
4XXXX-4XXXXXX
5XXXX-5XXXXXX

<tbody>
</tbody>
Part NumberSerial NumberDataData
1XXXX-1XXXXXX
2XXXX-2XXXXXX
3XXXX-3XXXXXX
4XXXX-4XXXXXX
5XXXX-5XXXXXX

<tbody>
</tbody>

I have a macro that will clear contents on the “Max Data” sheet based on certain criteria. The result will look something like this:

Part NumberSerial NumberDataData
1XXXX-1XXXXXX
2XXXX-3XXXXXX
3XXXX-5XXXXXX
4
5

<tbody>
</tbody>
Part NumberSerial NumberDataData
1XXXX-1XXXXXX
2XXXX-2XXXXXX
3XXXX-3XXXXXX
4XXXX-4XXXXXX
5XXXX-5XXXXXX

<tbody>
</tbody>

What I need is a macro that compares the values in Column B of both sheets and clears contents from the “Min Data” sheet if it’s not found on the “Min Data” sheet. Looking at the images above the value in B7 on the “Min Data” sheet is not found in column B on the “Max Data” sheet. I need to clear the contents from the “Min Data” sheet also. The calculations in the last row of both sheets is used elsewhere hence the need to clear contents rather than delete the entire row.

Any help would be greatly appreciated!



Edit: Reading this after posting it looks really confusing. Sorry about that.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,054
Latest member
juliecooper255

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