Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Better / faster solution for OptionButtons?


I have a userForm with 5 OptionButtons within a Frame on it (there'
also a ComboBox on this userForm, which is irrelevant to this issue.)
In order to figure out which OptionButton was picked, I have thi
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 I
-------------------

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

--
AMK
-----------------------------------------------------------------------
AMK4's Profile: http://www.excelforum.com/member.php...fo&userid=1914
View this thread: http://www.excelforum.com/showthread.php?threadid=50628

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Better / faster solution for OptionButtons?


Bumping since it fell off to page 6 since last night..

--
AMK
-----------------------------------------------------------------------
AMK4's Profile: http://www.excelforum.com/member.php...fo&userid=1914
View this thread: http://www.excelforum.com/showthread.php?threadid=50628

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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" wrote in message
...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Better / faster solution for OptionButtons?


Sorry Tim, here's the original message:

AMK4 Wrote:
I have a userForm with 5 OptionButtons within a Frame on it (there'
also a ComboBox on this userForm, which is irrelevant to this issue.)
In order to figure out which OptionButton was picked, I have thi
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 I

-------------------

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


--
AMK
-----------------------------------------------------------------------
AMK4's Profile: http://www.excelforum.com/member.php...fo&userid=1914
View this thread: http://www.excelforum.com/showthread.php?threadid=50628

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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" wrote in message
...

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
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
UserForm OptionButtons Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 3 October 4th 07 07:52 PM
Can faster CPU+larger/faster RAM significantly speed up recalulati jmk_li Excel Discussion (Misc queries) 2 September 28th 05 10:24 AM
Choosing Only One Of Three OptionButtons Minitman[_4_] Excel Programming 2 August 18th 05 12:59 PM
OptionButtons Paul Excel Programming 4 December 4th 03 04:12 PM
optionbuttons Phil Perry Excel Programming 1 July 10th 03 09:13 PM


All times are GMT +1. The time now is 08:24 PM.

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"