thank you to anyone who can help i am making a userform to input employees times. i plan to have a worksheet for each employe i would the userform to copy all data from the right text boxes and send them to the right sheet based on the name. each time this happens it needs to go into a new row.
Private Sub CommandButton1_Click()
Dim cNum As Integer
Dim X As Integer
Dim nextrow As Range
Dim sht As String
'set the variable for the sheet
sht = con1.Value
sht = con2.Value
sht = con3.Value
sht = con4.Value
sht = con5.Value
'Check for values
If Me.ComboBox1.Value = "" Then
MsgBox "Please select a person who is filing out the form"
Exit Sub
End If
'change the number for the number of controls on the userform
cNum = 5
'add the data to the selected worksheet
Set nextrow = Sheets(sht).Cells(Rows.Count, 6).End(xlUp).Offset(1, 0)
For X = 1 To cNum
nextrow = Me.Controls("Reg" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
'clear the Values in the userform
For X = 1 To cNum
Me.Controls("Reg""con" & X).Value = ""
Next
'communicate the results
MsgBox "Thank you"
hopefully this makes sense
Private Sub CommandButton1_Click()
Dim cNum As Integer
Dim X As Integer
Dim nextrow As Range
Dim sht As String
'set the variable for the sheet
sht = con1.Value
sht = con2.Value
sht = con3.Value
sht = con4.Value
sht = con5.Value
'Check for values
If Me.ComboBox1.Value = "" Then
MsgBox "Please select a person who is filing out the form"
Exit Sub
End If
'change the number for the number of controls on the userform
cNum = 5
'add the data to the selected worksheet
Set nextrow = Sheets(sht).Cells(Rows.Count, 6).End(xlUp).Offset(1, 0)
For X = 1 To cNum
nextrow = Me.Controls("Reg" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
'clear the Values in the userform
For X = 1 To cNum
Me.Controls("Reg""con" & X).Value = ""
Next
'communicate the results
MsgBox "Thank you"
hopefully this makes sense