vba Userform question

Stephenosn

Board Regular
Joined
Jun 2, 2015
Messages
52
I'm trying to build a Userform to make entering time sheets easier. Our employees can work on several different jobs with various pieces of equipment during a day and I need to sort them out based on this and date.

My current form (sorry I'm not sure how to post a pic) consists of a single combo box for various jobs, then under that are eight rows of text/combo boxes with a column for date, employee, task, equipment and duration. At the bottom is a command button.


The Information is transferred to specific sheets based on their job.

My question. I would like to use only one date box and have it transfer to the sheets with all eight rows of information. I use eight now because I'm not sure how to leave a row empty and have the information become misaligned with missing data.

This is my current command button code.

Private Sub CommandButton3_Click()
Dim lr As Long
Dim sheet As String
sheet = Job_Name_Cmb.Text


lr = Sheets(sheet).Range("C" & Rows.Count).End(xlUp).Row
Sheets(sheet).Cells(lr + 1, "C").Value = task1.Text
lr = Sheets(sheet).Range("C" & Rows.Count).End(xlUp).Row
Sheets(sheet).Cells(lr + 1, "C").Value = Task2.Text
lr = Sheets(sheet).Range("C" & Rows.Count).End(xlUp).Row
Sheets(sheet).Cells(lr + 1, "C").Value = Task3.Text
lr = Sheets(sheet).Range("C" & Rows.Count).End(xlUp).Row
Sheets(sheet).Cells(lr + 1, "C").Value = Task4.Text
lr = Sheets(sheet).Range("C" & Rows.Count).End(xlUp).Row
Sheets(sheet).Cells(lr + 1, "C").Value = Task5.Text
lr = Sheets(sheet).Range("C" & Rows.Count).End(xlUp).Row
Sheets(sheet).Cells(lr + 1, "C").Value = Task6.Text
lr = Sheets(sheet).Range("C" & Rows.Count).End(xlUp).Row
Sheets(sheet).Cells(lr + 1, "C").Value = Task7.Text
lr = Sheets(sheet).Range("C" & Rows.Count).End(xlUp).Row
Sheets(sheet).Cells(lr + 1, "C").Value = Task8.Text


ETC.


Thanks for any help
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
It would be nice to have the information from the userform transferred to the specific sheet with the date on the top the when the next entry comes in it would go in the next available row, again starting with the date.
 
Upvote 0

Forum statistics

Threads
1,207,422
Messages
6,078,438
Members
446,337
Latest member
nrijkers

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