Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display contents of a cell in a user form text box -- Excel 2003 VBA hiskilini Excel Discussion (Misc queries) 7 April 4th 23 10:22 AM
I want user form to display when opening a work book JohannM Excel Worksheet Functions 1 September 14th 06 12:23 AM
user form question: text box to display result BigPig Excel Discussion (Misc queries) 0 February 28th 06 12:33 AM
user form question: text box to display result BigPig Excel Worksheet Functions 0 February 25th 06 08:17 PM
User Form to display more than 1 reslut EstherJ Excel Programming 1 August 23rd 04 01:40 PM


All times are GMT +1. The time now is 09:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"