Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default programming checkbox properties

Hey.

I have a range of cells for which I would like to put a
checkbox in the center of each cell.

This works for creating the checkbox:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1",
Left:=ActiveCell.Left + ActiveCell.Width / 2 - 7,
Top:=ActiveCell.Top + ActiveCell.Height / 2 - 7,
Width:=14, Height _
:=14).Select


What I need now is to link the checkbox to the cell that
it was just placed in.

I know it's using the .LinkedCell property, but I haven't
found what vb code will do it.

??
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default programming checkbox properties

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1",
Left:=ActiveCell.Left + ActiveCell.Width / 2 - 7,
Top:=ActiveCell.Top + ActiveCell.Height / 2 - 7,
Width:=14, Height _
:=14).Select
Selection.LinkedCell = ActiveCell.Address(external:=True)

--
Regards,
Tom Ogilvy


"mark" wrote in message
...
Hey.

I have a range of cells for which I would like to put a
checkbox in the center of each cell.

This works for creating the checkbox:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1",
Left:=ActiveCell.Left + ActiveCell.Width / 2 - 7,
Top:=ActiveCell.Top + ActiveCell.Height / 2 - 7,
Width:=14, Height _
:=14).Select


What I need now is to link the checkbox to the cell that
it was just placed in.

I know it's using the .LinkedCell property, but I haven't
found what vb code will do it.

??
Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default programming checkbox properties

Selection.LinkedCell = ActiveCell.Address(external:=True)


Thanks, Tom.

I should have thought of that.

I think I did try Selection.LinkedCell , but I made the
mistake of giving it the cell as a range, instead of the
cell address as string text.

But it wasn't giving me a type error, it was giving me a
property not supported error, and I didn't happen to think
about needing to use the address.

Thanks for you help.

Mark
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default programming checkbox properties

Selection.LinkedCell = ActiveCell.Address(external:=True)



as a followup, can you tell me why when the checkbox is
selected, adding the code line:

Selection.Caption = ""

produces Run Time Error 38 Object doesn't support this
property or method


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default programming checkbox properties

Try selection.Object.Caption

activesheet.OleObjects(1).Select
? typename(selection)
OLEObject
? selection.Object.Caption
CheckBox1


--
Regards,
Tom Ogivly

"mark" wrote in message
...
Selection.LinkedCell = ActiveCell.Address(external:=True)




as a followup, can you tell me why when the checkbox is
selected, adding the code line:

Selection.Caption = ""

produces Run Time Error 38 Object doesn't support this
property or method






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default programming checkbox properties

Try selection.Object.Caption

That works.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
vba programming biker man Excel Discussion (Misc queries) 1 August 28th 07 04:02 PM
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
properties of excel button/checkbox yaniv Excel Programming 1 August 6th 04 03:16 AM
Programming Help Nate[_5_] Excel Programming 6 May 21st 04 08:08 PM
programming vba in vb AAAAA Excel Programming 3 December 25th 03 02:44 PM


All times are GMT +1. The time now is 11:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"