I've devised a linked cell reference for a form control checkbox, .LinkedCell = Worksheets("sheet1").Range("D" & myCell.Row & "").Value
, that will unfortunately not link to the specified cell. Although, the caption reference does work. I've placed the entire macro below:
Sub test()
Dim myBox As CheckBox
Dim myCell As Range
Dim cellRange As String
With ActiveSheet
For Each myCell In .Range("B10:B12").Cells
With myCell
Set myBox = .Parent.CheckBoxes.Add(Top:=.Top, Width:=.Width, Left:=.Left, Height:=.Height)
With myBox
.LinkedCell = Worksheets("sheet1").Range("D" & myCell.Row & "").Value
.Caption = Worksheets("sheet1").Range("B" & myCell.Row & "").Value
.Name = "checkbox_" & myCell.Address(0, 0)
End With
.NumberFormat = ";;;"
End With
Next myCell
End With
End Sub
I've tried to reference the cell in this way also: .Range("sheet1!B" & myCell.Row).Value
. This method fails completely.
Thanks for any suggestions.
Regards,
Aucun commentaire:
Enregistrer un commentaire