dropkickweasel
Board Regular
- Joined
- Feb 2, 2014
- Messages
- 70
Hi,
I'm struggling with VBA syntax/commands/everything, I'm hoping this is a simple fix for someone with more experience/knowledge than me.
I have a userform with five options buttons and a command button to confirm the selection.
The names and labels of the option buttons appear in a named range on my worksheet. (Named, "Market").
The five items in the named range each have an associated value. (Named, "Price").
For now, I want the user to be able to select one of the five options and for the price of that option to appear in cell I2.
Here's the code I have managed to piece together so far that is not working:
What is the correct syntax for "the name of whichever option button is selected" that I hope I can replace "Control.Name" with in the formula to make it work?
I'm struggling with VBA syntax/commands/everything, I'm hoping this is a simple fix for someone with more experience/knowledge than me.
I have a userform with five options buttons and a command button to confirm the selection.
The names and labels of the option buttons appear in a named range on my worksheet. (Named, "Market").
The five items in the named range each have an associated value. (Named, "Price").
For now, I want the user to be able to select one of the five options and for the price of that option to appear in cell I2.
Here's the code I have managed to piece together so far that is not working:
Code:
Private Sub Confirm_Click()
Sheets("Sheet1").Range("I2") = Application.WorksheetFunction.XLookup(Control.Name, Range("Market"), Range("Price"))
End Sub
What is the correct syntax for "the name of whichever option button is selected" that I hope I can replace "Control.Name" with in the formula to make it work?