+ Reply to Thread
Results 1 to 2 of 2

Align check boxes

  1. #1
    Registered User
    Join Date
    01-09-2004
    Location
    Palm Bay, Fl.
    Posts
    13

    Cool Align check boxes

    I have a lot of check boxes to put on a worksheet. Is there any way I can get them to line up automatically? I want to put two check boxes in each cell with a letter next to each. I have tried the copy and paste but that did not work. When I pasted to another cell it came in lower than the one I copied and yes, the cells are the same highth. Made no sense. Any help will be appreciated. Thanks.

  2. #2
    Dave Peterson
    Guest

    Re: Align check boxes

    If the checkboxes are already there, you can show the drawing toolbar.

    Then click on the Arrow icon.
    Select the left hand checkboxes
    then click on the Draw icon on that Drawing toolbar
    Then click on Align or Distribute
    and align them where you want.

    Then do the right hand checkboxes.

    Personally, I think I'd align the checkboxes to cells with a macro that actually
    added the checkboxes.

    I'm not sure how you get the letters that go next to each, but this adds
    checkboxes from the Forms toolbar to G2:H21 (20 checkboxes per column)

    Option Explicit
    Sub testme()

    Dim myCBX As CheckBox
    Dim myCell As Range
    Dim myRng As Range

    With ActiveSheet
    Set myRng = .Range("G2:G21")
    .CheckBoxes.Delete 'nice for setting up
    'resize to two columns
    For Each myCell In myRng.Resize(, 2).Cells
    With myCell
    Set myCBX = .Parent.CheckBoxes.Add _
    (Top:=.Top, Width:=.Width, _
    Left:=.Left, Height:=.Height)
    With myCBX
    .LinkedCell = myCell.Address(external:=True)
    .Caption = ""
    .Name = "CBX_" & myCell.Address(0, 0)
    End With
    .NumberFormat = ";;;"
    End With

    Next myCell
    End With
    End Sub

    Are you sure you shouldn't be using optionbuttons? If you can only select one
    of these "checkboxes" per row, then OptionButtons may make your life simpler.

    If you're new to macros, you may want to read David McRitchie's intro at:
    http://www.mvps.org/dmcritchie/excel/getstarted.htm

    You may be able to steal something from Debra Dalgleish's site if you need
    Optionbuttons (also from the Forms toolbar):

    http://www.contextures.com/xlform01.html

    edrachel wrote:
    >
    > I have a lot of check boxes to put on a worksheet. Is there any way I
    > can get them to line up automatically? I want to put two check boxes
    > in each cell with a letter next to each. I have tried the copy and
    > paste but that did not work. When I pasted to another cell it came in
    > lower than the one I copied and yes, the cells are the same highth.
    > Made no sense. Any help will be appreciated. Thanks.
    >
    > --
    > edrachel
    > ------------------------------------------------------------------------
    > edrachel's Profile: http://www.excelforum.com/member.php...fo&userid=4736
    > View this thread: http://www.excelforum.com/showthread...hreadid=534252


    --

    Dave Peterson

+ 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