Morning,
I'm creating an Excel Rota for managing staff. I've created a simple userform which allows staff to request annual leave. The form saves the date into another sheet where the data can be analysed to show staff on leave on any given date etc.
An Example;
Name: Joe Bloggs
Leave Request Date: 31/08/2016
Once completed it saves the data entered onto another sheet named Requests. This background sheet is used for availability planning etc. A few other userforms accesses this data so that can approve the request, update the request etc. It works fine for Single day requests however i'm trying to work out a way so that if I Put a Range such as From 31/08/2016 to 03/09/2016 it will record the following onto the requests sheet.
Name Request Date
Joe Bloggs 31/08/2016
Joe Bloggs 01/09/2016
Joe Bloggs 02/09/2016
Joe Bloggs 03/09/2016
At this point in time i've no idea how to code this to do this so any help would be greatly appreciated.
Code I have for the single request Userform is below;
I'm creating an Excel Rota for managing staff. I've created a simple userform which allows staff to request annual leave. The form saves the date into another sheet where the data can be analysed to show staff on leave on any given date etc.
An Example;
Name: Joe Bloggs
Leave Request Date: 31/08/2016
Once completed it saves the data entered onto another sheet named Requests. This background sheet is used for availability planning etc. A few other userforms accesses this data so that can approve the request, update the request etc. It works fine for Single day requests however i'm trying to work out a way so that if I Put a Range such as From 31/08/2016 to 03/09/2016 it will record the following onto the requests sheet.
Name Request Date
Joe Bloggs 31/08/2016
Joe Bloggs 01/09/2016
Joe Bloggs 02/09/2016
Joe Bloggs 03/09/2016
At this point in time i've no idea how to code this to do this so any help would be greatly appreciated.
Code I have for the single request Userform is below;
Code:
Private Sub cmdAdd_Click()'Copy input values to sheet.
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Requests")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(lRow, 1).Value = Me.StaffList.Value
.Cells(lRow, 2).Value = Me.DateReq.Value
.Cells(lRow, 3).Value = Me.SubDate.Value
End With
'Clear input controls.
Me.StaffList.Value = ""
Me.DateReq.Value = ""
Me.SubDate.Value = ""
MsgBox "Your Holiday request has been submitted"
ActiveWorkbook.Save
End Sub