One mo
Option Explicit
Sub addCBX()
Dim myCBX As CheckBox
Dim myCell As Range
With ActiveSheet
.CheckBoxes.Delete 'nice for testing
For Each myCell In ActiveSheet.Range("a1:a50").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
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
I used the cell under the checkbox as the linked cell. But I gave it a custom
format of ;;;. You can see the value in the formula bar, but it looks empty
when you look at the worksheet.
Herd wrote:
I would like to add a checkbox in each row that has a specific value in
column "B" (i.e. "Mark") and then link that check box to another column in
the same row. Can this be done with a loop so that I do not have to manually
do this? Thanks for the help.
--
Dave Peterson