+ Reply to Thread
Results 1 to 5 of 5

Better / faster solution for OptionButtons?

  1. #1
    Registered User
    Join Date
    01-28-2005
    Posts
    70

    Better / faster solution for OptionButtons?

    I have a userForm with 5 OptionButtons within a Frame on it (there's also a ComboBox on this userForm, which is irrelevant to this issue.) In order to figure out which OptionButton was picked, I have this snippet of code:
    Please Login or Register  to view this content.
    There has got to be an easier, maybe faster way of setting targetForm. please tell me there is. I can't imaging having many OptionButtons and having to do this If ... ElseIf ... Else ... End If routine...

  2. #2
    Registered User
    Join Date
    01-28-2005
    Posts
    70
    Bumping since it fell off to page 6 since last night...

  3. #3
    Tim Williams
    Guest

    Re: Better / faster solution for OptionButtons?

    If you're going to "bump" you might consider including the original text.
    Many people use an actual newsreader and hide read messages, so all I'm
    seeing is your bump.

    Tim
    --
    Tim Williams
    Palo Alto, CA


    "AMK4" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Bumping since it fell off to page 6 since last night...
    >
    >
    > --
    > AMK4
    > ------------------------------------------------------------------------
    > AMK4's Profile:

    http://www.excelforum.com/member.php...o&userid=19143
    > View this thread: http://www.excelforum.com/showthread...hreadid=506283
    >




  4. #4
    Registered User
    Join Date
    01-28-2005
    Posts
    70
    Sorry Tim, here's the original message:

    Quote Originally Posted by AMK4
    I have a userForm with 5 OptionButtons within a Frame on it (there's also a ComboBox on this userForm, which is irrelevant to this issue.) In order to figure out which OptionButton was picked, I have this snippet of code:
    Please Login or Register  to view this content.
    There has got to be an easier, maybe faster way of setting targetForm. please tell me there is. I can't imaging having many OptionButtons and having to do this If ... ElseIf ... Else ... End If routine...

  5. #5
    Tim Williams
    Guest

    Re: Better / faster solution for OptionButtons?

    A bit more maintainable:

    z = -1
    For x = 1 To 4
    If Me.Controls("targetForm" & x).Value = True Then
    z = x
    Exit For
    End If
    Next x
    If z = -1 Then z = 99

    Tim.

    --
    Tim Williams
    Palo Alto, CA


    "AMK4" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Sorry Tim, here's the original message:
    >
    > AMK4 Wrote:
    > > I have a userForm with 5 OptionButtons within a Frame on it (there's
    > > also a ComboBox on this userForm, which is irrelevant to this issue.)
    > > In order to figure out which OptionButton was picked, I have this
    > > snippet of code:>

    > Code:
    > --------------------
    > > > If targetForm1 = True Then

    > > targetForm = 1
    > > ElseIf targetForm2 = True Then
    > > targetForm = 2
    > > ElseIf targetForm3 = True Then
    > > targetForm = 3
    > > ElseIf targetForm4 = True Then
    > > targetForm = 4
    > > ElseIf targetFormCU = True Then
    > > targetForm = 99
    > > Else
    > > errForm = True
    > > End If

    > --------------------
    > > >

    > > There has got to be an easier, maybe faster way of setting
    > > *targetForm*. please tell me there is. I can't imaging having many
    > > OptionButtons and having to do this *If ... ElseIf ... Else ... End
    > > If* routine...

    >
    >
    > --
    > AMK4
    > ------------------------------------------------------------------------
    > AMK4's Profile:

    http://www.excelforum.com/member.php...o&userid=19143
    > View this thread: http://www.excelforum.com/showthread...hreadid=506283
    >




+ 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