Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Add OptionButtons in Excel

Oli,

First, to have the two sets of two option buttons work as
two independant groups, you should put each of the two
option buttons inside a "frame" tool. This is the little
box with XYX at the top in the VBA toolbox. You can
change the name displayed on the frame by changing its
Caption property. You will need to display the
Properties window in VBA by pressing the F4 button. As
you select a component on your userform (say Frame1), the
properties window will display all the properties for
that particular control.

Second, you can change the captions of each of the option
buttons by selecting the particular option button on the
userform, then changing the Caption property again in the
Properties window. If the current caption is
OptionButton1, then double click on that name and type in
whatever you want it to be (ex: change the Caption
property from "OptionButton1" to "Add 10").

Third, you will need to provide the code to make each
option button do its thing. Below is a very simple
example for the code to make the first two option buttons
work (selecting option 1 will add 10 to whatever the
current cell value is, selecting option 2 will subtract
10 from the current cell value).


Private Sub OptionButton1_Click()
If OptionButton1 = True Then
ActiveCell.Value = ActiveCell.Value + 10
End If
End Sub

Private Sub OptionButton2_Click()
If OptionButton2 = True Then
ActiveCell.Value = ActiveCell.Value - 10
End If
End Sub

Hopefully this gives you some ideas. You can change the
code in each of the option buttons to cause the specific
action you desire (i.e. change "ActiveCell.Value =
ActiveCell.Value - 10" to whatever you need).

Andrew Lenczycki
-----Original Message-----
Hi!

I've got only few experiences in programming with VBA,

because of that I've
got several Problems with adding OptionButtons using VBA

in an Excel Sheet.

First: I would like to add 4 Option Buttons and give

them different names
(captions)

Next: I would like do group them into 2 groups.

After that: I would like to change values of different

cells after the value
of an optionbutton has changed.

If there is somone out there, who could give me an

example how to solve this
I would be very pleased

Thx Oli

.

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
Control ToolBox OptionButtons? Ken Excel Discussion (Misc queries) 8 May 23rd 07 04:22 PM
Moving OptionButtons MarkyB Excel Discussion (Misc queries) 2 March 7th 06 02:50 PM
Need help creating a userform with optionbuttons TB[_2_] Excel Programming 2 July 21st 03 02:16 PM
optionbuttons Phil Perry Excel Programming 1 July 10th 03 09:13 PM


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