ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting LinkedCell on a CheckBox Control (https://www.excelbanter.com/excel-programming/305578-setting-linkedcell-checkbox-control.html)

scottrell

Setting LinkedCell on a CheckBox Control
 
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("CheckB ox1").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

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Setting LinkedCell on a CheckBox Control
 
With ActiveWorkbook.Worksheets("Sheet1").OleObjects("Ch eckBox1")
.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.

--
Regards,
Tom Ogilvy


"scottrell " wrote in message
...
Excel XP SP2
I need to set the LinkedCell property on a control with VB, both for
optionbuttons and checkboxes, but I cannot find a way to access the
property in VB (I also want to set the GroupName and Caption, but
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("CheckB ox1").Name =
"Checkbox1Name"

but not the other three properties mentioned above.

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

-sc


---
Message posted from http://www.ExcelForum.com/




scottrell[_2_]

Setting LinkedCell on a CheckBox Control
 
Thank you.

Exactly what I needed.

-s

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 09:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com