VBA - Copy Cells from one sheet to another based on ComboBox value

Wardylewis

New Member
Joined
Jun 7, 2016
Messages
37
Good Evening,

I have a sheet called Employee List which holds information on every employee and what tests they require.

However, when employees need booking in for tests it takes a fair bit of sorting, is very time consuming and messy which leads to data input errors.

I was wondering if there was a way that I could do this automatically with VBA and transfer employees based on a specific criteria.

In worksheet "employee list" I have 25 columns which hold various pieces of data. Need it to start on row 6 and then check down to the end row looking to see if column 25 matches the set criteria.



Employee List
[TABLE="width: 500"]
<tbody>[TR]
[TD]Emp ID[/TD]
[TD]First Name[/TD]
[TD]Surname[/TD]
[TD]Dept[/TD]
[TD]Unit[/TD]
[TD]Site[/TD]
[TD]Shift[/TD]
[TD]A[/TD]
[TD]Atime[/TD]
[TD]C[/TD]
[TD]Ctime[/TD]
[TD]F[/TD]
[TD]FTime[/TD]
[TD="align: center"]Shortest Time[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]Mickey[/TD]
[TD="align: center"]Mouse[/TD]
[TD="align: center"]Costume[/TD]
[TD="align: center"]D1[/TD]
[TD="align: center"]Disney[/TD]
[TD="align: center"]Days[/TD]
[TD="align: center"]Yes[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]Yes[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]Yes[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]-10
[/TD]
[/TR]
</tbody>[/TABLE]


The booking sheet has ComboBox1 which has a value of either 30/60/90 and when a value has been selected and CommandButton1 is pressed I need it to search column 25 on the Employee List sheet and then paste the information from the columns 1 - 7, 13,15 etc and place it into the booking sheet starting from B3.

I have looked online and google all afternoon but cannot seem to get it right. It either throws errors or pastes the data on top of each other.

I am new to VBA so an explanation of how it works and what it is doing would be really useful so I can learn from my mistakes.

Thank you for any support it is greatly appreciated.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I do not understand this:
paste the information from the columns 1 - 7, 13,15 etc

1-7,13,15 etc. what would etc. look like I see no trend here.

Do you mean copy entire row?

And if copy entire row we cannot start the pasting in Column B

 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,154
Members
452,615
Latest member
bogeys2birdies

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