Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i display a value in a user form as a result of a selectio.
I am trying to get a value to return in a label within a user form once an
option in a combobox is selected. This is how I have tried it: With cboTariff2 .AddItem "50006" .AddItem "50002" .AddItem "50005" End With If cboTariff2 = 50006 Then Label74 = "£10.58" ElseIf cboTariff2.Text = "50002" Then Label74 = "£11.51" ElseIf cboTariff2.Text = "50005" Then Label74 = "£11.85" End If |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i display a value in a user form as a result of a selectio.
Try .Value
With cboTariff2 .AddItem "50006" .AddItem "50002" .AddItem "50005" End With If cboTariff2.Value = "50006" Then Label74 = "£10.58" ElseIf cboTariff2.Value = "50002" Then Label74 = "£11.51" ElseIf cboTariff2.Value = "50005" Then Label74 = "£11.85" End If Mike F "ptoddx1" wrote in message ... I am trying to get a value to return in a label within a user form once an option in a combobox is selected. This is how I have tried it: With cboTariff2 .AddItem "50006" .AddItem "50002" .AddItem "50005" End With If cboTariff2 = 50006 Then Label74 = "£10.58" ElseIf cboTariff2.Text = "50002" Then Label74 = "£11.51" ElseIf cboTariff2.Text = "50005" Then Label74 = "£11.85" End If |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i display a value in a user form as a result of a selectio.
Private Sub cboTariff2_click()
If cboTariff2 = 50006 Then Label74 = "£10.58" ElseIf cboTariff2.Text = "50002" Then Label74 = "£11.51" ElseIf cboTariff2.Text = "50005" Then Label74 = "£11.85" End If End Sub -- Regards, Tom Ogilvy "ptoddx1" wrote in message ... I am trying to get a value to return in a label within a user form once an option in a combobox is selected. This is how I have tried it: With cboTariff2 .AddItem "50006" .AddItem "50002" .AddItem "50005" End With If cboTariff2 = 50006 Then Label74 = "£10.58" ElseIf cboTariff2.Text = "50002" Then Label74 = "£11.51" ElseIf cboTariff2.Text = "50005" Then Label74 = "£11.85" End If |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i display a value in a user form as a result of a selectio.
Noticed you left the quotes of the first check
The key point was, you can't set the values in the list and handle the selection in the same routine. Load the list in the Userform_initialize() event and use the click event to handle the selection. Private Sub cboTariff2_click() If cboTariff2 = "50006" Then Label74 = "£10.58" ElseIf cboTariff2.Text = "50002" Then Label74 = "£11.51" ElseIf cboTariff2.Text = "50005" Then Label74 = "£11.85" End If End Sub -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... Private Sub cboTariff2_click() If cboTariff2 = 50006 Then Label74 = "£10.58" ElseIf cboTariff2.Text = "50002" Then Label74 = "£11.51" ElseIf cboTariff2.Text = "50005" Then Label74 = "£11.85" End If End Sub -- Regards, Tom Ogilvy "ptoddx1" wrote in message ... I am trying to get a value to return in a label within a user form once an option in a combobox is selected. This is how I have tried it: With cboTariff2 .AddItem "50006" .AddItem "50002" .AddItem "50005" End With If cboTariff2 = 50006 Then Label74 = "£10.58" ElseIf cboTariff2.Text = "50002" Then Label74 = "£11.51" ElseIf cboTariff2.Text = "50005" Then Label74 = "£11.85" End If |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Display contents of a cell in a user form text box -- Excel 2003 VBA | Excel Discussion (Misc queries) | |||
I want user form to display when opening a work book | Excel Worksheet Functions | |||
user form question: text box to display result | Excel Discussion (Misc queries) | |||
user form question: text box to display result | Excel Worksheet Functions | |||
User Form to display more than 1 reslut | Excel Programming |