Hi
I haven't done this in a while, so would appreciate it if someone could help, please.
I'd like to create a warning when someone clicks on a button, to ask them if they have already clicked on a different button.
The buttons are 'get data' and 'analyse data'
So I'd like to create a message box that asks a user if they've clicked on the 'get data' button and if they answer 'no,' then the code exits (exit sub).
If they answer 'yes,' then the code in the 'analyse data' macro runs.
I've put this together, but need to amend it - does anyone know how?
TIA
I haven't done this in a while, so would appreciate it if someone could help, please.
I'd like to create a warning when someone clicks on a button, to ask them if they have already clicked on a different button.
The buttons are 'get data' and 'analyse data'
So I'd like to create a message box that asks a user if they've clicked on the 'get data' button and if they answer 'no,' then the code exits (exit sub).
If they answer 'yes,' then the code in the 'analyse data' macro runs.
I've put this together, but need to amend it - does anyone know how?
VBA Code:
Sub Test()
Dim Ans
Ans = MsgBox("Have you clicked on the 'Get Data' Button", vbNo)
If Ans = vbNo Then
MsgBox "Click on the 'Get Data' button"
Exit Sub
Else
If Ans = vbYes Then
'run the code that follows this comment
End If
End Sub
TIA