+ Reply to Thread
Results 1 to 4 of 4

Selecting many Checkboxes to align & size

Hybrid View

  1. #1
    Registered User
    Join Date
    12-07-2004
    Posts
    18

    Selecting many Checkboxes to align & size

    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!


  2. #2
    Chip Pearson
    Guest

    Re: Selecting many Checkboxes to align & size

    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
    >




  3. #3
    Chip Pearson
    Guest

    Re: Selecting many Checkboxes to align & size

    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
    >>

    >
    >




  4. #4
    Registered User
    Join Date
    12-07-2004
    Posts
    18

    Talking Thanks

    That has sorted it thanks Chip!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1