Add a value next to a matching name in another sheet using vba

wanders

New Member
Joined
Aug 10, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I am looking for advice as to the best way to set something up, I have this page which is used to show which employees are needed on specific job sites each day.

This is what I have in a tab named labor info

This is what I have in a tab named labor info


The idea is that different team leaders will submit what job they are on and who they will need vs. will not need on their crew the next day.

When someone clicks the add button I want the information to be filled into a second tab named "dailylabor".

This is what the second sheet looks like:
This is the tab named 'DailyLabor'


My intention is to continue adding columns so that today's date is always in C1 and tomorrow is B1.

When the add button is clicked, I need it to look at

Sheets("LaborInfo").Range("C2:C100") and find the matching name in Sheets("DailyLabor").Range("A2:A100") and then if Sheets("LaborInfo").Range("D2:D100") put the value in Sheets("LaborInfo").Range("B2") into Sheets("DailyLabor").Range("B2:B100")

My problem is that this will be submitted multiple times and I don't want it to overwrite information. At first I was thinking abouut doing something where it inserts a formula (vlookup) but that would return an error in all the ones that do not match and overwrite.

So instead I am thinking it should be an if else loop but I don't know how to deal with the part where it needs to find the correct name.

I hope this was clear and please let me know how I can make it more clear.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
questions:
1- "I don't want it to overwrite information." What exactly is being overwritten?
2- after a TL adds an employee should that employee be made unavailable to subsequent TL's ?
3- are you using ActiveX or Form Control Check Boxes
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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