MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question
I have a VBA macro that I have been using to update a roster with planned and unplanned leave.
What I was hoping to do was to have the ability within the same code or a separate code to:
- Delete requests that are no longer required
- Change the type of planned or unplanned leave
Here is the script that I use to add planned and unplanned leave, any help in making the above changes I would really appreciate.
Private Sub cbbAdd_Click() answer = MsgBox("Are you sure you want make the changes?", vbYesNo + vbQuestion, "Add Record") If answer = vbYes Then Dim LeaveDate As Date LeaveDate = txtLeaveStart.Text Dim LeaveEnd As Date LeaveEnd = txtLeaveEnd.Text Dim FirstName As String FirstName = FirstNameCombo.Text Dim LeaveType As String LeaveType = LeaveTypeCombo.Text Dim DateAdded As Date Dim wsh As Worksheet Set wsh = ThisWorkbook.Worksheets("Leave") Set tbl = wsh.ListObjects("tblEmployees") Dim lRow As ListRow For LeaveDate = CDate(txtLeaveStart.Text) To CDate(txtLeaveEnd.Text) Set lRow = tbl.ListRows.Add With lRow .Range(1) = LeaveDate .Range(2) = FirstName .Range(3) = LeaveType .Range(5) = Now() End With Next End If MsgBox "Complete" End Sub