Hello,
I’m back with question on displaying a text box on a form (frmPITI) based on the selection of combo box.
As Example (TryMe1.xls) –
Column E is populated with YEAR
Column F is populated with AMOUNT
The ComboBox (comBoxYEAR) has a list of years based on range(“E9:F19”).
When I select a year in the combo box (say 2025) I want the text box (txtBoxAMT) to display the value in the corresponding cell to the right. That is, cell E11 = 2025 and cell F11 = $3,333.33. So, I want the list box (txtBoxAMT) to read $3,333.33. If I select a different year (say 2027), I want the corresponding amount one column to the right of the cell that is 2027 (Year would be in E13 and the amount in F13).
Originally I was trying to do this via IF statements but was never successful (no surprise). Then I thought about using a Lookup Table. My “test” Lookup table is E9:F19. This is only as a test. I’m hoping if I get this working I will be able to apply the process to all other options.
Here is some code I have added to do some of what I have in mind:
Here is a screen shot of my test file:
Thanks for viewing,
Steve K.
I’m back with question on displaying a text box on a form (frmPITI) based on the selection of combo box.
As Example (TryMe1.xls) –
Column E is populated with YEAR
Column F is populated with AMOUNT
The ComboBox (comBoxYEAR) has a list of years based on range(“E9:F19”).
When I select a year in the combo box (say 2025) I want the text box (txtBoxAMT) to display the value in the corresponding cell to the right. That is, cell E11 = 2025 and cell F11 = $3,333.33. So, I want the list box (txtBoxAMT) to read $3,333.33. If I select a different year (say 2027), I want the corresponding amount one column to the right of the cell that is 2027 (Year would be in E13 and the amount in F13).
Originally I was trying to do this via IF statements but was never successful (no surprise). Then I thought about using a Lookup Table. My “test” Lookup table is E9:F19. This is only as a test. I’m hoping if I get this working I will be able to apply the process to all other options.
Here is some code I have added to do some of what I have in mind:
VBA Code:
Private Sub txtBox1_Change()
Me.txtBox1.Value = Format(Me.txtBox1.Value, "$0,000.00")
End Sub
Private Sub UserForm_Initialize()
txtBox1.Value = Range("F4")
comBoxYEAR.List = Range("E9:E19").Value
End Sub
Here is a screen shot of my test file:
Thanks for viewing,
Steve K.