I want the userform "frmRequest" to unload the data from its comboboxes and testboxes onto two (2) seperate worksheets "Master" and "Leave Request" at the same time. This coding works for the worksheet "Leave Request", but can't get it to work with both worksheet "Master" and "Leave Request". Your help would br appreciated.
[VBA]Private Sub cmdEmpAdd_Click()
Dim strLastRow As Integer
'Get last row
strLastRow = xlLastRow("Leave Request")
Application.EnableEvents = False
With Sheets("Leave Request")
'If textboxes not null then fill data of textboxes to worksheet.
If (frmEmpRequest.cboEmpName.Value <> vbNullString And frmEmpRequest.cboEmpType.Value <> vbNullString And _
frmEmpRequest.txtEmpStart.Value <> vbNullString And frmEmpRequest.txtEmpEnd.Value <> vbNullString) Then
.Cells(strLastRow + 1, 1).Value = frmEmpRequest.cboEmpName.Value
.Cells(strLastRow + 1, 2).Value = Format(Now, "mmm-dd-yyyy hh:mm:ss")
.Cells(strLastRow + 1, 3).Value = frmEmpRequest.cboEmpType.Value
.Cells(strLastRow + 1, 4).Value = CDate(frmEmpRequest.txtEmpStart.Text)
.Cells(strLastRow + 1, 5).Value = CDate(frmEmpRequest.txtEmpEnd.Text)
strLastRow = strLastRow + 1
'Update listbox with added values
frmEmpRequest.lstEmpBox.RowSource = "'Leave Request'!A2:E" & strLastRow
'Empty textboxes
frmEmpRequest.cboEmpName.Value = vbNullString
frmEmpRequest.cboEmpType.Value = vbNullString
frmEmpRequest.txtEmpStart.Value = vbNullString
frmEmpRequest.txtEmpEnd.Value = vbNullString
Else
MsgBox "Please Enter Data"
End If
End With
Application.EnableEvents = True
End Sub[/VBA]