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
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