View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
rmcveigh rmcveigh is offline
external usenet poster
 
Posts: 1
Default Macro for checkbox generation


Hi all,

I'm not the most experienced of Excel users so please bear with me. I'
looking to generate a macro (because I'm lazy) that will place about 50
checkboxes in a single column, row by row. It also needs to move an
resize according to the data in an adjacent cell (i.e. if the text nex
to it is too large and wordwraps another line, the box must move wit
it). One checkbox per row is what I'm getting at.

This is the code I'm currently using:
Dim myCBX As CheckBox
Dim myCell As Range

With ActiveSheet
.CheckBoxes.Delete 'nice for setting up
For Each myCell In ActiveSheet.Range("O13:O503").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

Please and thanks

--
rmcveig
-----------------------------------------------------------------------
rmcveigh's Profile: http://www.excelforum.com/member.php...fo&userid=3735
View this thread: http://www.excelforum.com/showthread.php?threadid=57145