Hi All,
I had the following code written for me but I want to be able to save the workbook everytime an entry is made.
Public Sub addEnquiry()
Dim MediumType As String
Dim EnquiryReason As String
Const Medium As Long = 1
Const Reason As Long = 2
With Sheets("input")
If .ListBoxes(Medium).Value = 0 Or .ListBoxes(Reason).Value = 0 Then
MsgBox "Complete both boxes"
Exit Sub
End If
MediumType = .ListBoxes(Medium).List(.ListBoxes(Medium).Value)
EnquiryReason = .ListBoxes(Reason).List(.ListBoxes(Reason).Value)
.ListBoxes(1).Value = 0
.ListBoxes(2).Value = 0
End With
With Sheets("data").Range("a1").CurrentRegion
.Offset(.Rows.Count).Resize(1, 3).Value = Array(MediumType, EnquiryReason, Now())
End With
End Sub
Can anyone help?
Thanks :)
I had the following code written for me but I want to be able to save the workbook everytime an entry is made.
Public Sub addEnquiry()
Dim MediumType As String
Dim EnquiryReason As String
Const Medium As Long = 1
Const Reason As Long = 2
With Sheets("input")
If .ListBoxes(Medium).Value = 0 Or .ListBoxes(Reason).Value = 0 Then
MsgBox "Complete both boxes"
Exit Sub
End If
MediumType = .ListBoxes(Medium).List(.ListBoxes(Medium).Value)
EnquiryReason = .ListBoxes(Reason).List(.ListBoxes(Reason).Value)
.ListBoxes(1).Value = 0
.ListBoxes(2).Value = 0
End With
With Sheets("data").Range("a1").CurrentRegion
.Offset(.Rows.Count).Resize(1, 3).Value = Array(MediumType, EnquiryReason, Now())
End With
End Sub
Can anyone help?
Thanks :)