+ Reply to Thread
Results 1 to 4 of 4

how do i display a value in a user form as a result of a selectio.

Hybrid View

Guest how do i display a value in a... 01-29-2005, 08:06 AM
Guest Re: how do i display a value... 01-29-2005, 12:06 PM
Guest Re: how do i display a value... 01-29-2005, 12:06 PM
Guest Re: how do i display a value... 01-29-2005, 01:06 PM
  1. #1
    ptoddx1
    Guest

    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. #2
    Mike Fogleman
    Guest

    Re: 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" <ptoddx1@discussions.microsoft.com> wrote in message
    news:43F51C27-1BA2-4510-8246-FC247A0D0E82@microsoft.com...
    >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. #3
    Tom Ogilvy
    Guest

    Re: 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" <ptoddx1@discussions.microsoft.com> wrote in message
    news:43F51C27-1BA2-4510-8246-FC247A0D0E82@microsoft.com...
    > 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. #4
    Tom Ogilvy
    Guest

    Re: 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" <twogilvy@msn.com> wrote in message
    news:OhhWushBFHA.3416@TK2MSFTNGP09.phx.gbl...
    > 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" <ptoddx1@discussions.microsoft.com> wrote in message
    > news:43F51C27-1BA2-4510-8246-FC247A0D0E82@microsoft.com...
    > > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1