I have a userform in Excel, and I placed a ComboBox called 'cboDonations' and a TextBox called 'TBDonationAmt'.
In the ComboBox I have three values (Guest, Members & Members+). This information is taken from a Sheet called 'Data' (column A, cell 2, 3 & 4).
Also on the 'Data' sheet I have a column called DonationAmount with 0, 1 & 2 (which means $0, $1 & $2 donations) in the cells 2, 3 & 4.
What I'm looking for is when I select from the comboBox 'cboDonations' it places the selected value into the TBDonationAmt text box.
The selected values must be taken from the sheet Data and from column DonationAmount.
In other words
Select Value from comboBox.
Take information from Data Sheet column DonationAmount.
Display results in TextBox.
If I select Guest from the cboDonations, then in the TBDonationAmt it will show $0
If I select Member from the cboDonations, then in the TBDonationAmt it will show $1
If I select Member+ from the cboDonations, then in the TBDonationAmt it will show $2
You can use the AfterUpdate
event of the combobox. When the event fires, you check the current (new) value and based on that you set the text box, for example:
Private Sub cboDonation_AfterUpdate()
If (cboDonation.Value = "Guest") Then TBDonationAmt.Value = "$0"
ElseIf (cboDonation.Value = "Member") Then TBDonationAmt.Value = "$1"
ElseIf (cboDonation.Value = "Member+") Then TBDonationAmt.Value = "$2"
End If
End Sub
You define this function in the code sheet of the form.