I've been working on this problem for hours now, so I'll really appreciate any answers.
I have a userform with three buttons and I like them to pass a value, so I can use that value in my main module and depending on the value, run a specific code. I searched everywhere but they all pass values from textboxs
Here is my userform code:
private sub cancelButton_Click()
response = 1
UserForm1.Hide
End Sub
private Sub SutunButton_Click()
response = 2
UserForm1.Hide
End Sub
private Sub TirButton_Click()
response = 3
UserForm1.Hide
End Sub
and this is my main module:
public response as integer
sub example()
.
.
.
userform1.show
if response=1 then
msgbox "1"
elseif response = 2 then
msgbox "2"
elseif response = 3 then
msgbox "3"
end if
.
.
.
end sub
Of course I put msgbox
to make my code simple.
Thanks for any help
Remove the global. To the module add:
Change the events to: