UserForm Checkboxes
I saw that mistake as I was trying the code. I also
inserted debug statements to make sure the If statement
was triggering correctly. The "before" values for height
and width and the "after" values are the same. And the as
displayed sizes fo the boxes or buttons varies.
-----Original Message-----
I did have two typos, one of which reference the size to
textbox1 instead of
checkbox1.
Private Sub Userform_Initialize()
For Each ctrl In UserForm1.Frame1.Controls
If TypeOf ctrl Is MSforms.CheckBox Then
ctrl.Height = UserForm1.Controls("checkbox1").Height
ctrl.Width = UserForm1.Controls("Checkbox1").Width
ctrl.Left = UserForm1.Controls("Checkbox1").Left
End If
Next
End Sub
worked fine for me. All the check boxes were the same
height and width -
although it didn't correct the spacing between
checkboxes - but that wasn't
part of the question.
I am not sure how they can have the same height and width
and exhibit the
differences you describe.
--
Regards,
Tom Ogilvy
"MWE" wrote in
message
...
the option buttons work; thanks. But now I have the
same
problem with size of the option buttons that I had with
the checkboxes. Your code does not do anything
different
than what I had already done manually, i.e., it sets
each
height and width equal to the same value. Whether I use
your code (which I tried) or do it manually, I get the
same results, i.e., there are box-to-box or button-to-
button size differences. I am using the default size
(height and width) for both boxes and buttons.
-----Original Message-----
Private Sub Userform_Initialize()
for each ctrl in Userform1.Frame1.controls
if typeof ctrl is MSforms.Textbox Then
ctrl.Heigth = Userform1.Controls
("checkbox1").Height
ctrl.Width = Userform1.Controls("Checkbox1").Width
ctrl.Left = Userform1.Controls("Checkbox1").Left
end if
Next
End Sub
for item 2, use optionbuttons - that is what they do by
default.
--
Regards,
Tom Ogilvy
MWE wrote in
message
...
1. CheckBox Size: I have several checkboxes that
are
identical in height and width, and spaced uniformly
within
a frame. The actual size of the checkbox "box"
varies
slightly from one to the next. The size differences
are
small but noticeable. Further the size
and "darkness"
(probably change in font size) of the checkmark (when
the
box value is true) varies as well, some are smaller
and "light" and some are larger and "dark". I have
fiddled around with heights (making them all one or
two
points larger or smaller), locations, etc., but can
not
get the boxes to be the same size. What am I doing
wrong
here?
2. CheckBox communications: I have several
checkboxes
in
a frame. I want to limit the user to one selection.
Thus
if box 1 is selected (value = True), boxes 2, 3 and 4
should automatically have values = False. How is
this
done?
.
.
|