Hi
Now my programs for my check boxes are working nicely thanks to Tom. It looks a little messy. How can I align and size all of my check boxes to be exactly the same.
I thought it would be obvious, to be fair it still could be!
![]()
Hi
Now my programs for my check boxes are working nicely thanks to Tom. It looks a little messy. How can I align and size all of my check boxes to be exactly the same.
I thought it would be obvious, to be fair it still could be!
![]()
I'm assuming you used checkboxes from the Controls toolbar. Set
the left, height and width properties of the first check box to
the values you desire, then run the following code:
Sub AAA()
Dim FirstCheckbox As msforms.CheckBox
Dim Chk As OLEObject
For Each Chk In ActiveSheet.OLEObjects
If TypeOf Chk.Object Is msforms.CheckBox Then
If FirstCheckbox Is Nothing Then
Set FirstCheckbox = Chk.Object
Else
Chk.Left = FirstCheckbox.Left
Chk.Height = FirstCheckbox.Height
Chk.Width = FirstCheckbox.Width
End If
End If
Next Chk
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Saz" <Saz.291gca_1149694503.1032@excelforum-nospam.com> wrote in
message news:Saz.291gca_1149694503.1032@excelforum-nospam.com...
>
> Hi
>
> Now my programs for my check boxes are working nicely thanks to
> Tom. It
> looks a little messy. How can I align and size all of my check
> boxes to
> be exactly the same.
>
> I thought it would be obvious, to be fair it still could be!
>
>
>
>
> --
> Saz
> ------------------------------------------------------------------------
> Saz's Profile:
> http://www.excelforum.com/member.php...o&userid=17226
> View this thread:
> http://www.excelforum.com/showthread...hreadid=549528
>
A better solution is as follows:
Sub AAA()
Dim ReferenceCheckbox As msforms.CheckBox
Dim Chk As OLEObject
Set ReferenceCheckbox =
ActiveSheet.OLEObjects("checkbox1").Object
For Each Chk In ActiveSheet.OLEObjects
If TypeOf Chk.Object Is msforms.CheckBox Then
Chk.Left = ReferenceCheckbox.Left
Chk.Height = ReferenceCheckbox.Height
Chk.Width = ReferenceCheckbox.Width
End If
Next Chk
End Sub
Change "checkbox1" to the checkbox whose properties you want to
use for left, height, and width.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Chip Pearson" <chip@cpearson.com> wrote in message
news:O1g4vkkiGHA.4884@TK2MSFTNGP03.phx.gbl...
> I'm assuming you used checkboxes from the Controls toolbar. Set
> the left, height and width properties of the first check box to
> the values you desire, then run the following code:
>
> Sub AAA()
> Dim FirstCheckbox As msforms.CheckBox
> Dim Chk As OLEObject
> For Each Chk In ActiveSheet.OLEObjects
> If TypeOf Chk.Object Is msforms.CheckBox Then
> If FirstCheckbox Is Nothing Then
> Set FirstCheckbox = Chk.Object
> Else
> Chk.Left = FirstCheckbox.Left
> Chk.Height = FirstCheckbox.Height
> Chk.Width = FirstCheckbox.Width
> End If
> End If
> Next Chk
> End Sub
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com
>
>
>
> "Saz" <Saz.291gca_1149694503.1032@excelforum-nospam.com> wrote
> in message
> news:Saz.291gca_1149694503.1032@excelforum-nospam.com...
>>
>> Hi
>>
>> Now my programs for my check boxes are working nicely thanks
>> to Tom. It
>> looks a little messy. How can I align and size all of my check
>> boxes to
>> be exactly the same.
>>
>> I thought it would be obvious, to be fair it still could be!
>>
>>
>>
>>
>> --
>> Saz
>> ------------------------------------------------------------------------
>> Saz's Profile:
>> http://www.excelforum.com/member.php...o&userid=17226
>> View this thread:
>> http://www.excelforum.com/showthread...hreadid=549528
>>
>
>
That has sorted it thanks Chip!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks