Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Can't get OptionButton choice result from form?!!

I'm *still* trying to modify John Walkenbach's code for creating an
option-button UserForm programmatically
(http://j-walk.com/ss/excel/tips/tip76.htm). Thanks to John Coleman, I can
now set the array to read my table rows and populate with the text of the
first cell in each row.

Now I can't get the result out! I have NO IDEA what I did! Even the MsgBox
didn't work! I modified the end to put the result into a string and MsgBox
the string, but it comes up as a blank MsgBox!

What did I do and how do I fix this?

Ed

Dim Ops As Variant
ReDim Ops(1 To cnt)

Dim i As Integer
Dim UserChoice As Variant

For i = 1 To cnt
strOpBtn = tbl.Cell(i, 1).Range.Text
strOpBtn = Left(strOpBtn, Len(strOpBtn) - 2)
Ops(i) = strOpBtn
Next i
UserChoice = GetOption(Ops, 1, "Select a color")
'If UserChoice < False Then MsgBox UserChoice
If UserChoice < False Then strChoice = UserChoice
MsgBox strChoice


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Can't get OptionButton choice result from form?!!

Hi Ed,

I don't know what the GetOption function is supposed to return, but it seems
to me that your strChoice assignment is not taking place. That is probably
due to the fact that GetOption is indeed returning False. Try setting a
breakpoint (see Debug menu in the VBE) on that line of code and then run
your macro. When you enter break mode, you can step through line by line,
and you'll hopefully see what's going on. You can hover over variables to
get their values at runtime and/or use the Immediate window to print out
values (use the ? character to output values to the window).

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]

Ed wrote:
I'm *still* trying to modify John Walkenbach's code for creating an
option-button UserForm programmatically
(http://j-walk.com/ss/excel/tips/tip76.htm). Thanks to John Coleman,
I can now set the array to read my table rows and populate with the
text of the first cell in each row.

Now I can't get the result out! I have NO IDEA what I did! Even the
MsgBox didn't work! I modified the end to put the result into a
string and MsgBox the string, but it comes up as a blank MsgBox!

What did I do and how do I fix this?

Ed

Dim Ops As Variant
ReDim Ops(1 To cnt)

Dim i As Integer
Dim UserChoice As Variant

For i = 1 To cnt
strOpBtn = tbl.Cell(i, 1).Range.Text
strOpBtn = Left(strOpBtn, Len(strOpBtn) - 2)
Ops(i) = strOpBtn
Next i
UserChoice = GetOption(Ops, 1, "Select a color")
'If UserChoice < False Then MsgBox UserChoice
If UserChoice < False Then strChoice = UserChoice
MsgBox strChoice



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
Formula (off form) that completes form data based on a result lldiel Excel Worksheet Functions 2 November 24th 09 11:09 PM
choice from a drop down list returns a result to a different cell thunderbunny Charts and Charting in Excel 2 April 12th 08 10:47 PM
excel how to take choice of 75 rows - create form of 10 selectons John B[_2_] Excel Worksheet Functions 2 April 11th 07 01:46 PM
OptionButton in a Form Fred Russell Excel Programming 4 September 18th 05 09:10 PM
how do i display a value in a user form as a result of a selectio. ptoddx1 Excel Programming 3 January 29th 05 04:42 PM


All times are GMT +1. The time now is 12:46 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"