Setting LinkedCell on a CheckBox Control

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
 
T

Tom Ogilvy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top