Spikenaylor
Board Regular
- Joined
- Apr 14, 2013
- Messages
- 116
- Office Version
- 365
- Platform
- Windows
I have tried unsuccessfully to achieve this
Display Input box "Please enter a reason"
If the X or Cancel is pressed the the routine ends
If OK is pressed and the input contains nothing, then display a message "Reason is required"
I cant seem to get this combination to work correctly
I have tried other variants but cannot get the Cancel and X option to be separate from the nothing is entered option.
Any help and guidance greatly appreciated.
Display Input box "Please enter a reason"
If the X or Cancel is pressed the the routine ends
If OK is pressed and the input contains nothing, then display a message "Reason is required"
I cant seem to get this combination to work correctly
Code:
Sub AuditTrail(batchnumber As String)
Dim batchunlock as boolean, batchunlockmessage as string
On Error Resume Next
Recheck:
batchunlock = Application.InputBox("Please enter the reason you are cancelling the Batch", "Cancelling Batch Reason")
batchunlockmessage = batchunlock
If batchunlock = False Then End
If batchunlockmessage = vbNullString Then
MsgBox ("You must enter a reason for cancelling the batch!")
GoTo Recheck
End If
On Error GoTo 0
Sheets("Audit_Trail").Cells(65536, 1).End(xlUp).Offset(1, 0).Value = " Date - " & Date & " " & " Time - " & Time & " " & " User - " & Application.UserName & " Batch number Cancelled - " & batchnumber & " Reason for Cancelling - " & batchunlockmessage & " " & " Sheet - " & ActiveSheet.Name
End Sub
I have tried other variants but cannot get the Cancel and X option to be separate from the nothing is entered option.
Any help and guidance greatly appreciated.