Macro needed to show popup box if data entered matches data in another sheet

dixon1983

Board Regular
Joined
Apr 23, 2005
Messages
175
Hi,
I have a spreadsheet which I add data to each day.
A seperate worksheet in this spreadsheet contains archived data.

I would like an error message to appear if I try to enter any data into column A in the master data sheet which matches data in Column A of the Archive sheet.

Many many thanks for anyone who can help me with this.

Regards,
Dixon
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hello Dixon

You could use Data Validation but you need to name the range on the archive sheet.

On the archive sheet highlight column A. In the 'Name Box' (left of formula bar) enter Archive (this will be the name for the range).

Now return to your entry sheet. Let us assume you are entering data in colum A starting from row 2.

Highlight A2 thru to A100 (lets assume that your data will not exceed row 100).
On the menu bar go Data > Validation.
Choose custom from the 'Allow:' drop down
Input this as the formula:
=ISNA(MATCH(A2,Archive,0))

Now go to the 'Error Alerrt' tab and enter your custom pop up message. You can also play with the style so that the message appears and does not allow a user to enter a value that already exists in the archive, or simply have it pop up as a warning.

Click Ok and it's done!

Amend ranges to suit.

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,203,242
Messages
6,054,353
Members
444,718
Latest member
r0nster

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