View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Keith-NB Keith-NB is offline
external usenet poster
 
Posts: 1
Default How do I put a check box in each row of a column

Biff,
I used this macro and it worked great, except that by row 130 my checkbox
appears in row 129.

My row heights are consistent 25.50 or 34 pixels.

Is there some adjustment I can make to the macro to correct for this?

Thanks!
Keith



"Biff" wrote:

Here's a macro by Dave Peterson.

Sub addCBX()
Dim myCBX As CheckBox
Dim myCell As Range

With ActiveSheet
.CheckBoxes.Delete 'nice for testing
For Each myCell In ActiveSheet.Range("A2:A10").Cells
With myCell
Set myCBX = .Parent.CheckBoxes.Add _
(Top:=.Top, Width:=.Width, _
Left:=.Left, Height:=.Height)
With myCBX
.LinkedCell = myCell.Address(external:=True)
.Caption = "" 'or whatever you want
.Name = "CBX_" & myCell.Address(0, 0)
End With
.NumberFormat = ";;;"
End With
Next myCell
End With
End Sub

Just change the range reference: ("A2:A10") to whatever you want. The macro
also sets the linked cell to be the same cell the checkbox is "in" and sets
the checkstate (TRUE or FALSE) to be "invisible". The Caption is set to no
caption. If you want the same caption in every checkbox you'll have to edit
that line. If you want a different caption in each checkbox then you'll have
to do it manually.

Biff

"SteveK" wrote in message
...
I want to create check boxes for each row in a column. I was wondering if
there is a way to relate the check box to one cell and maybe drag the
bottom
right corner down and have it copy down the row. Is there a way to do this
or
another approach i might be able to use? Thanks ahead of time