Check user input against list and automatically add non-existent values to list?

awesomedan

New Member
Joined
Jun 16, 2017
Messages
1
Hi! I have a complex problem that I've spent hours searching up solutions for, but haven't been able to find what I need.

I'm looking for a VBA code that will do the following:


  1. Look at a list of user-inputted data on Sheet1 (Something like A1=Potato, A2 = Cabbage, A3 = Turnips)
  2. Check this list against a larger list of vegetables in Sheet3 (Something like A1=Carrot, A2 = Beet, A3 = Lettuce) to see whether Potato exists in the list, whether Cabbage exists, and so on.
  3. If any user-inputted value (Potato, cabbage, turnips) exists in the large list, I want nothing to happen.
  4. If any user-inputted value does not exist in this list, I want several things to happen:
    1. The value is added to this master list automatically
    2. The value (Ex. Potato) is entered into Sheet2 below the last row used on that sheet.
    3. Additional data (Strings, mostly) is entered in the cells to the right of the cell that "Potato" is entered into.


Some more details:

  • This spreadsheet is primarily to be used for entering contacts into a software database en masse. The reason this is necessary is because the program we're using takes tab delimited files and requires data to be in specific columns for data to be accepted. Contacts can enter their own name, phone number, email, etc into the spreadsheet and the code I've already written will paste those values into the second sheet in a format our software will accept. They can also enter a Group Name, which I want to be entered as though it were another contact, so I need to the group name to be pasted into the second sheet as though it were a contact but only if doesn't already exist in a list.
  • I have three sheets. The first sheet is for user inputs, the second sheet is a sheet that gets saved as a Tab delimited file for use elsewhere, and the third sheet is where I'm storing values for dropdown lists and other things. I want to check the user inputs against a list in the third sheet, and if the input doesn't exist, add it to the list while also entering data in the second sheet.
  • The code I've already written just copies values from the first sheet into the second sheet using the lastrow method, and then highlights every cell whose value is "Unknown".
  • I've tried using arrays, the Scripting Dictionary object, and Select Case arguments on my own to no avail. As far as I understand, the Scripting Dictionary is the least ideal method for me, as I want users to be able to add and take away values from the master list without having to go into the developer tab and stuff.
  • If it helps, I'm using an ActiveX button.



I am a complete novice at VBA programming and this is far beyond what I could ever hope to achieve on my own. Any and all help would be greatly appreciated!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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