Setting LinkedCell on a CheckBox Control

  • Thread starter Thread starter scottrell
  • Start date Start date
S

scottrell

Excel XP SP2
I need to set the LinkedCell property on a control with VB, both fo
optionbuttons and checkboxes, but I cannot find a way to access th
property in VB (I also want to set the GroupName and Caption, bu
assume the answer would be similar).

I'm able to set the name (height, width, top, left, etc) with (e.g.):

ActiveWorkbook.Worksheets("Sheet1").Shapes("CheckBox1").Name
"Checkbox1Name"

but not the other three properties mentioned above.

These controls are on a worksheet and not a form, the Help system ha
let me down.

-s
 
With ActiveWorkbook.Worksheets("Sheet1").OleObjects("CheckBox1")
.Name = "Checkbox1Name"
.LinkedCell = "Sheet3!A1"
.Object.Caption = "ABCD:
.Object.GroupName = "Group1"
End With

the linkedcell property is provided by the container which is the OleObject
Shape and OleObject share the same name. In xl2000 and later, the checkbox
name will also be the OleObject and ShapeName.

The caption is a property of the Checkbox, so you have to append .Object to
the OleObject to refer to the checkbox. Same for groupname.
 
Back
Top