JeffGrant
Well-known Member
- Joined
- Apr 7, 2021
- Messages
- 516
- Office Version
- 365
- Platform
- Windows
Hi All,
I know I am doing something exceptionally simple and maybe I am being silly but when I collect variables from the UserForm Code and pass it to a module, the variables loose their value.
This is the code from the OptionButton1_Click
In the VBA Module itself, I also have
In the OptionButton1_Click Code, the variable gets assigned properly, because I have checked that with a msgbox, but when I call the CopyResults Routine to wrtite the variables out to another sheet all I get is a blank for the horse name and 0 for the returned value.
What am I missing ?
Cheers
I know I am doing something exceptionally simple and maybe I am being silly but when I collect variables from the UserForm Code and pass it to a module, the variables loose their value.
This is the code from the OptionButton1_Click
VBA Code:
Option Explicit
Public Horse As String, Ret As Double
Private Sub OptionButton1_Click()
Sheet1.Activate
' Read Variables for when more than one horse is selected
Horse = Range("T3").Value
Ret = Range("T2").Value
Call CopyResults
End Sub
In the VBA Module itself, I also have
VBA Code:
Option Explicit
Public Horse As String, Ret As Double
In the OptionButton1_Click Code, the variable gets assigned properly, because I have checked that with a msgbox, but when I call the CopyResults Routine to wrtite the variables out to another sheet all I get is a blank for the horse name and 0 for the returned value.
What am I missing ?
Cheers