VBA / macro to match multiple Criteria on two sheets then copy and paste cell value

CliffWeb

New Member
Joined
Aug 15, 2016
Messages
23
I need a macro to match/find Rep list and ID on Sheet 1 with Sheet 2 then copy and paste Skill Level from sheet 2 under the correct Skill on Sheet 1. I have a list of over 300 Reps and about 20 different skills and each skills has a levels ranging from 1-8. Below is a quick a example of how sheet 1 should look after comparing the list matching and copying the value from the Data to sheet 1. Sorry I don't know how to add the grid lines but Rep name is A3 and so on.



Rep 1Rep ID 1
Rep 2Rep ID 2
Rep 3Rep ID 3
Rep 4Rep ID 4
Rep 5Rep ID 5
Rep 1Rep ID 1
Rep 2Rep ID 2
Rep 3Rep ID 3
Rep 4Rep ID 4
Rep 5Rep ID 5

<tbody>
[TD="bgcolor: #00ffff, colspan: 4, align: center"]Sheet 1[/TD]

[TD="bgcolor: #00ffff"]Rep Name[/TD]
[TD="bgcolor: #00ffff"]Rep ID[/TD]
[TD="bgcolor: #00ffff, align: right"]1510[/TD]
[TD="bgcolor: #00ffff, align: right"]1511[/TD]
[TD="bgcolor: #00ffff, align: right"]1512[/TD]
[TD="bgcolor: #00ffff, align: right"]1516[/TD]
[TD="bgcolor: #00ffff, align: right"]1517[/TD]
[TD="bgcolor: #00ffff, align: right"]1688[/TD]

[TD="align: right"]6[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]

[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]5[/TD]

[TD="align: right"]5[/TD]

[TD="align: right"]3[/TD]

[TD="align: right"]2[/TD]

[TD="align: right"]3[/TD]

[TD="align: right"]4[/TD]
[TD="align: right"]1[/TD]

[TD="align: right"]3[/TD]

[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]

[TD="bgcolor: #00ff00, colspan: 5, align: center"]Sheet 2 Data Sheet[/TD]

[TD="bgcolor: #00ff00"]Rep Name[/TD]
[TD="bgcolor: #00ff00"]Rep ID[/TD]
[TD="bgcolor: #00ff00"]Skill01[/TD]
[TD="bgcolor: #00ff00"]Skill01 Lvl[/TD]
[TD="bgcolor: #00ff00"]Skill02[/TD]
[TD="bgcolor: #00ff00"]Skill02 Lvl[/TD]
[TD="bgcolor: #00ff00"]Skill03[/TD]
[TD="bgcolor: #00ff00"]Skill03 Lvl[/TD]

[TD="align: right"]1517[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1688[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1516[/TD]
[TD="align: right"]6[/TD]

[TD="align: right"]1510[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]1511[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1512[/TD]
[TD="align: right"]5[/TD]

[TD="align: right"]1688[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1516[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1510[/TD]
[TD="align: right"]5[/TD]

[TD="align: right"]1516[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1510[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1512[/TD]
[TD="align: right"]4[/TD]

[TD="align: right"]1511[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1517[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1688[/TD]
[TD="align: right"]1[/TD]

</tbody>
 
I will have a look if you can provide a new set of data (file) that shows a complete example of the variety of these clockings with expected results. !!!

would it be better to rewrite to code to display the information as it is in the image below? If it is, then I would prefer this. The goals is to eliminate the steps it takes to view the break # and time, prefer to view both on one page. Highlight time below 15mins and above 30 mins using Red font. here is a link to the file https://app.box.com/s/mgyqhghtmtne7qsmqblabhp5ryrjgtjq and link to the image if needed. https://app.box.com/s/bh28t69swyynn03r6t5z7ym4p7s9lxan

bh28t69swyynn03r6t5z7ym4p7s9lxan
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
The previous code is of no use as the differentiating of days can only be done by determining the time lapse between breaks, (not Dates) assuming the Break are , say over 3 or 4 hrs then that space can represent the next day.
Please try the new attached File !!

https://app.box.com/s/fp6a7jx8kfusgx1z8d3snrhzw773fxdk

Some reps work 8 or 10 hrs daily the max is 16hrs. I guess I posted the above a little late before you this code. I was hoping to use the newer layout in the link above your comment to minimize the effort to see the actual time of the break. 2nd. I was hoping this would be all vba to hide the formulas. I have a strong feelings people with dibble dabble in the formula and mess it up. Thanks again.

Here are the links the 2nd one is a photo of the ideal layout tablehttps://app.box.com/s/mgyqhghtmtne7qsmqblabhp5ryrjgtjq and link to the image if needed. https://app.box.com/s/bh28t69swyynn03r6t5z7ym4p7s9lxan
 
Last edited:
Upvote 0
Here's an update based on your latest post,but one (I think your latest looks much the same as the previous)
The formulas are only in the "Break columns", and are placed there by the code for use in Code for the "Time Breaks" Header box. You just need to run the code again and the formulas will be replaced.
For Update of the Breaks "Break down" at top of Sheet , just Click on a break time from the "breaks Columns.

https://app.box.com/s/iztp2m605ka43fpuh6ucszqrebhpa64h
 
Last edited:
Upvote 0
Here's an update based on your latest post,but one (I think your latest looks much the same as the previous)
The formulas are only in the "Break columns", and are placed there by the code for use in Code for the "Time Breaks" Header box. You just need to run the code again and the formulas will be replaced.
For Update of the Breaks "Break down" at top of Sheet , just Click on a break time from the "breaks Columns.

https://app.box.com/s/iztp2m605ka43fpuh6ucszqrebhpa64h
Yes I like this. Will test it on Monday. Thanks plenty. Sorry for the headache if I caused any.
 
Upvote 0
Yes I like this. Will test it on Monday. Thanks plenty. Sorry for the headache if I caused any.
The code works, I think I just have to review the data more closely. Some Reps are showing 75647 mins for break times, some are showing 0 in the table but display the actual time and length of the break above the table on the first sheet.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

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