I am running a code on vba and I display the results using the MsgBox. I want to keep these results displayed as I enter the result values in a separate excel file but Excel doesn't allow me to work on another excel file until I press OK or Cancel button on MsgBox. How do keep msgbox on and still work on the separate excel file ?
Don't use a MsgBox
. Use a customized Userform
instead and then call it showing it as modeless
UserForm1.Show vbModeless
For example
Sub Sample()
'
'~~> Rest of your code
'
MsgBox "Hello World"
'
'~~> Rest of your code
'
End Sub
can be also written as
Sub Sample()
'
'~~> Rest of your code
'
UserForm1.Label1.Caption = "Hello World"
UserForm1.Show vbModeless
'
'~~> Rest of your code
'
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With