In this post I’m going to show you how to use a variable in a vba message box.
This is used commonly to notify the user that an entered item in a combo box is not in the list, also
per this post it’s to display the error number or the error description to the user when handling errors.
Here is how it goes:
Sub VBAMsgboxVariable() Dim strError As String Dim intError As Integer On Error GoTo errhandler intError = 1 / 0 Exit Sub errhandler: strError = Err.Description MsgBox "Your error is: " & strError End Sub
Let me know if you have any questions.