Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Dynamic Optionbutton Captions

Hi group,

WinXP Pro
Office 2003

I have created a userform with a frame and 22 optionbuttons. I have
made all optionbuttons hidden (visible=false). What I need to do is
when the form is shown to use a range's value as the caption for the
optionbuttons and to also make them visible. Not all buttons will
always be required, that is why I made them hidden when designing.

I have tried several different loops without success. Any help would be
greatly appreciated.

The buttons are named "PlayerOptBut1,
PlayerOptBut2.......PlayerOptBut22"

Here is my last attempt:

rr = Sheets("RND1").Range("A65536").End(xlUp).Row

For i = 2 To rr
ButtonCaption = Sheets("RND1").Range("D" & i).Value & ". " & _
Sheets("RND1").Range("C" & i).Value & " " & _
Sheets("RND1").Range("B" & i).Value

MatchDayForm.TeamListFrame.PlayerOptBut(i).Caption =
ButtonCaption
MatchDayForm.TeamListFrame.PlayerOptBut(i).Visible = True
Next i

Regards

Rob

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Dynamic Optionbutton Captions

I don't think you want to include the name of the frame enclosing the option
buttons.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"WizOfAus" wrote in message
ups.com...
Hi group,

WinXP Pro
Office 2003

I have created a userform with a frame and 22 optionbuttons. I have
made all optionbuttons hidden (visible=false). What I need to do is
when the form is shown to use a range's value as the caption for the
optionbuttons and to also make them visible. Not all buttons will
always be required, that is why I made them hidden when designing.

I have tried several different loops without success. Any help would be
greatly appreciated.

The buttons are named "PlayerOptBut1,
PlayerOptBut2.......PlayerOptBut22"

Here is my last attempt:

rr = Sheets("RND1").Range("A65536").End(xlUp).Row

For i = 2 To rr
ButtonCaption = Sheets("RND1").Range("D" & i).Value & ". " & _
Sheets("RND1").Range("C" & i).Value & " " & _
Sheets("RND1").Range("B" & i).Value

MatchDayForm.TeamListFrame.PlayerOptBut(i).Caption =
ButtonCaption
MatchDayForm.TeamListFrame.PlayerOptBut(i).Visible = True
Next i

Regards

Rob



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Dynamic Optionbutton Captions

Hi Jon,

Thanks for the prompt reply.

I tried the following and received this error "Method or data member
not found (Error 461)"
---------------------------------------------------------------------
rr = Sheets("RND1").Range("A65536").End(xlUp).Row

For i = 2 To rr
ButtonCaption = Sheets("RND1").Range("D" & i).Value & ". " & _
Sheets("RND1").Range("C" & i).Value & " " & _
Sheets("RND1").Range("B" & i).Value

MatchDayForm.PlayerOptBut(i - 1).Caption = ButtonCaption
MatchDayForm.PlayerOptBut(i - 1).Visible = True
Next i
---------------------------------------------------------------------

I believe the error is in this part of the code "PlayerOptBut(i - 1)".

Regards

Rob

Jon Peltier wrote:
I don't think you want to include the name of the frame enclosing the option
buttons.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Dynamic Optionbutton Captions

Hi Charles,

That did the trick. Thanks very much for your timely assistance and
also to Jon.

Charles Chickering wrote:
Try this:
MatchDayForm.TeamListFrame.Controls("PlayerOptBut" & i).Caption = ...
--
Charles Chickering

"A good example is twice the value of good advice."


"WizOfAus" wrote:

Hi group,

WinXP Pro
Office 2003

I have created a userform with a frame and 22 optionbuttons. I have
made all optionbuttons hidden (visible=false). What I need to do is
when the form is shown to use a range's value as the caption for the
optionbuttons and to also make them visible. Not all buttons will
always be required, that is why I made them hidden when designing.

I have tried several different loops without success. Any help would be
greatly appreciated.

The buttons are named "PlayerOptBut1,
PlayerOptBut2.......PlayerOptBut22"

Here is my last attempt:

rr = Sheets("RND1").Range("A65536").End(xlUp).Row

For i = 2 To rr
ButtonCaption = Sheets("RND1").Range("D" & i).Value & ". " & _
Sheets("RND1").Range("C" & i).Value & " " & _
Sheets("RND1").Range("B" & i).Value

MatchDayForm.TeamListFrame.PlayerOptBut(i).Caption =
ButtonCaption
MatchDayForm.TeamListFrame.PlayerOptBut(i).Visible = True
Next i

Regards

Rob



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Dynamic Optionbutton Captions

Interesting, I've never included it.

I missed the use of PlayerOptBut(i) instead of Controls("PlayerOptBut" & i).
Answered this morning before the caffeine kicked in.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Charles Chickering" wrote in
message ...
Actually Jon, I've found that if I don't include the frame in the line my
code runs much slower than if I do include it.
--
Charles Chickering

"A good example is twice the value of good advice."


"Jon Peltier" wrote:

I don't think you want to include the name of the frame enclosing the
option
buttons.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"WizOfAus" wrote in message
ups.com...
Hi group,

WinXP Pro
Office 2003

I have created a userform with a frame and 22 optionbuttons. I have
made all optionbuttons hidden (visible=false). What I need to do is
when the form is shown to use a range's value as the caption for the
optionbuttons and to also make them visible. Not all buttons will
always be required, that is why I made them hidden when designing.

I have tried several different loops without success. Any help would be
greatly appreciated.

The buttons are named "PlayerOptBut1,
PlayerOptBut2.......PlayerOptBut22"

Here is my last attempt:

rr = Sheets("RND1").Range("A65536").End(xlUp).Row

For i = 2 To rr
ButtonCaption = Sheets("RND1").Range("D" & i).Value & ". " & _
Sheets("RND1").Range("C" & i).Value & " " & _
Sheets("RND1").Range("B" & i).Value

MatchDayForm.TeamListFrame.PlayerOptBut(i).Caption =
ButtonCaption
MatchDayForm.TeamListFrame.PlayerOptBut(i).Visible = True
Next i

Regards

Rob








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Dynamic Optionbutton Captions

It makes sense that it's faster, since it more directly references the
controls. I'd just never thought of it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Charles Chickering" wrote in
message ...
Jon, if you get board sometime, take and place several (50-100) controls
inside several different frames, then loop through with and without
specifically calling the frame, unless my office 2003 install is whacked
(which is always a possibility) calling the frame.control will be
significantly faster.
--
Charles Chickering

"A good example is twice the value of good advice."


"Jon Peltier" wrote:

Interesting, I've never included it.

I missed the use of PlayerOptBut(i) instead of Controls("PlayerOptBut" &
i).
Answered this morning before the caffeine kicked in.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Charles Chickering" wrote
in
message ...
Actually Jon, I've found that if I don't include the frame in the line
my
code runs much slower than if I do include it.
--
Charles Chickering

"A good example is twice the value of good advice."


"Jon Peltier" wrote:

I don't think you want to include the name of the frame enclosing the
option
buttons.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"WizOfAus" wrote in message
ups.com...
Hi group,

WinXP Pro
Office 2003

I have created a userform with a frame and 22 optionbuttons. I have
made all optionbuttons hidden (visible=false). What I need to do is
when the form is shown to use a range's value as the caption for the
optionbuttons and to also make them visible. Not all buttons will
always be required, that is why I made them hidden when designing.

I have tried several different loops without success. Any help would
be
greatly appreciated.

The buttons are named "PlayerOptBut1,
PlayerOptBut2.......PlayerOptBut22"

Here is my last attempt:

rr = Sheets("RND1").Range("A65536").End(xlUp).Row

For i = 2 To rr
ButtonCaption = Sheets("RND1").Range("D" & i).Value & ". " &
_
Sheets("RND1").Range("C" & i).Value & " " & _
Sheets("RND1").Range("B" & i).Value

MatchDayForm.TeamListFrame.PlayerOptBut(i).Caption =
ButtonCaption
MatchDayForm.TeamListFrame.PlayerOptBut(i).Visible = True
Next i

Regards

Rob









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
X axis captions Stefi Charts and Charting in Excel 6 September 11th 08 01:16 PM
createing a dynamic array of buttons with captions loaded from she ouch Excel Discussion (Misc queries) 3 June 5th 07 03:27 AM
How do I put captions on Excel charts? pgrizzell Charts and Charting in Excel 1 June 8th 06 10:14 PM
Userform Captions Greg[_27_] Excel Programming 3 May 23rd 06 07:23 PM
Help! How to get all the command's captions within a CommandBars? OKLover[_2_] Excel Programming 1 July 13th 05 08:28 AM


All times are GMT +1. The time now is 04:58 PM.

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

About Us

"It's about Microsoft Excel"