ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checkbox1.LinkedCell = ActiveCell "Why wont this work?& (https://www.excelbanter.com/excel-programming/309635-checkbox1-linkedcell-%3D-activecell-why-wont-work.html)

TimeTraveller - ExcelForums.com

Checkbox1.LinkedCell = ActiveCell "Why wont this work?&
 
Have little bit of code that dumps Activex Checkbox on page, sizes i
to fi
in nicely to the ActiveCell. Works beautifully, except I want to mak
th
linked cel the active cel as well, and I really don't want to have t
g
into design mode and do it manually for every checkbox I create. Fo
som
reason this code does not work as I expect. I'm sure theres
fundamenta
principle I am unaware of

Checkbox1.LinkedCell = ActiveCel

Also another question: When dumping the checkboxes on the page, the
ar
incremented by 1..eg Checkbox1, Checkbox2 etc. Seems to me there mus
be a
index somewhere that keeps track of these. How can I refer thes
checkboxe
by their ordinal number programmatically at runtime so that I can d
operations with the checkbox at that time, using the index or th
ordina
part of the string. I could write something to strip the ordinal par
out o
the name, but that seems like a major kluge
--------
Message sent via www.excelforums.com

Tom Ogilvy

Checkbox1.LinkedCell = ActiveCell "Why wont this work?&
 
Checkbox1.LinkedCell = ActiveCell.Address(external:=True)


Dim OleObj as Object
Dim cbox as MSforms.Checkbox
for each OleObj in Activesheet.OleObjects
if typeof OleObj.Object is MSforms.Checkbox then
set cbox = OleObj.Object
or


Dim cBox as MSForms.Checkbox
for i = 1 to 10
set cbox = Activesheet.OleObjects("Checkbox" & i).Object


--
regards,
Tom Ogilvy


"TimeTraveller - ExcelForums.com"
wrote in message ...
Have little bit of code that dumps Activex Checkbox on page, sizes it
to fit
in nicely to the ActiveCell. Works beautifully, except I want to make
the
linked cel the active cel as well, and I really don't want to have to
go
into design mode and do it manually for every checkbox I create. For
some
reason this code does not work as I expect. I'm sure theres a
fundamental
principle I am unaware of.

Checkbox1.LinkedCell = ActiveCell

Also another question: When dumping the checkboxes on the page, they
are
incremented by 1..eg Checkbox1, Checkbox2 etc. Seems to me there must
be an
index somewhere that keeps track of these. How can I refer these
checkboxes
by their ordinal number programmatically at runtime so that I can do
operations with the checkbox at that time, using the index or the
ordinal
part of the string. I could write something to strip the ordinal part
out of
the name, but that seems like a major kluge.
---------
Message sent via www.excelforums.com




TimeTraveller - ExcelForums.com

Checkbox1.LinkedCell = ActiveCell "Why wont this wo
 
Bless you Tom
Just what I needed. I am SO grateful
--------
Message sent via www.excelforums.com


All times are GMT +1. The time now is 04:13 PM.

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