D
Donny
In my worksheet, I have buttons to run macros, and I also have a
UserForm. In the worksheet code I have:
Dim Money as Double
Private Sub StartButton_Click()
Money = 100
End Sub
Then, in the UserForm code:
Dim StoreMoney as Double
'--I have macros that set the value of StoreMoney
Private Sub BuyStuff_Click()
If Money >= StoreMoney Then
Money = Money - StoreMoney
Sheet1.Range("E9") = Money
Else: OK = MsgBox("You don't have enough money!", vbOKOnly, "Not
enough cash!")
End If
End Sub
The problem is that the userform does not know that Money=100, so it
just set's it at zero. How can I tell the userform code to use the
variable from the worksheet code?
Thanks,
Chris
UserForm. In the worksheet code I have:
Dim Money as Double
Private Sub StartButton_Click()
Money = 100
End Sub
Then, in the UserForm code:
Dim StoreMoney as Double
'--I have macros that set the value of StoreMoney
Private Sub BuyStuff_Click()
If Money >= StoreMoney Then
Money = Money - StoreMoney
Sheet1.Range("E9") = Money
Else: OK = MsgBox("You don't have enough money!", vbOKOnly, "Not
enough cash!")
End If
End Sub
The problem is that the userform does not know that Money=100, so it
just set's it at zero. How can I tell the userform code to use the
variable from the worksheet code?
Thanks,
Chris