Listbox copy last rows depanding on how many are selected in listbox?

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hi guys,

I have some issues with getting following to work.. or better am a bit stuck on how to go about it.

In my userform I have a listbox with employees...
Two texboxes with txtStart, txtEnd and a monthview and some other comboboxes for different data to insert into my worksheet.

What I like to achieve is when I select those employees I like to copy the same data

so the data looks like below

Date.........Start...........End...............Activity...........Employee........Objekt......Total Time
1/1/2016...08:00..........12:00............Loading...........Müller..............Gruber......4

What I like to do is after selecting different employees in the lstEmployees say for example ...Huber; Maier;

to insert the via VBA
Date.........Start...........End...............Activity...........Employee........Objekt......Total Time
1/1/2016...08:00..........12:00............Loading...........Huber..............Gruber......4
1/1/2016...08:00..........12:00............Loading...........Maier ..............Gruber......4

and if I select only one of corse it would be entered like to first example... or three employees three times and so on..

I got the code worked out for copy the last used row but it would be great if it works depanding on which employee(s) are selected in the listbox..

Hope this is clear what I am after and someone could help me with this.. please!

Many thanks
 

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"
Hi guys,

I understand that this has to go with a loop so the listbox can add those items into a worksheet.. but what if I have the StatTime EndTime and Project and other information that needs to be transfered into the worksheet like the data writen above?
Would be very nice if someone can give me a bit of help on thisone..

Many thanks
 
Upvote 0
So you would have a row for each employee selected in the listbox.

The employee name would go in the 5th column and the rest of data from the various textboxes/comboxes etc in columns 1-4 and 6-7.

Is that about right?
 
Upvote 0
Hi Norie,
yes I like a row for each employee and the rest of the data comes form textboxes and comboboxes..
So basically that I only enter the information once and then depanding on how many employees are working on a project and task and so on is entered automatically..
 
Upvote 0
Should be pretty straightforward.

Can you post further details?
 
Upvote 0
Hi Norie,
sure what do you need?
There are monthview for the date, txtStart for start Time txtEnd for Endtime... combobox for activity and a function to calculate the timedifference..
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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