|
-
Apr 15th, 2004, 06:32 AM
#1
Thread Starter
Fanatic Member
Checkbox in Worksheet Cell
Can anyone help me with code to Embed a Checkbox control into a Cell in an Excel Worksheet?
Thanks
Last edited by Mindcrime; Apr 15th, 2004 at 07:48 AM.
Mindcrime : )
ICQ 24003332
VB 5.0, VB 6.0 SP5, COM, DCOM, VB.NET Beta 2, Oracle 8
-
Apr 15th, 2004, 07:06 AM
#2
Addicted Member
There are 2 sorts of checkbox, from Forms toolbar or Controls toolbar. The latter have more properties but can become very buggy at times. Avoid if possible.
Code:
'- checkbox from Forms
ActiveSheet.CheckBoxes.Add(55.5, 60.75, 77.25, 18.75).Select
'- Checkbox from Controls
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", _
Link:=False, DisplayAsIcon:=False, Left:=57, _
Top:=103.5, Width:=69.75, Height:=18).Select
Regards
BrianB
-------------------------------
-
Apr 15th, 2004, 07:47 AM
#3
Thread Starter
Fanatic Member
Thanks for that.
Which cell is it contained in?
Sorry, but I have already tried that and resizing the row/col will not resize the control held in the cell (or which actually floats above the spreadsheet).
Mindcrime : )
ICQ 24003332
VB 5.0, VB 6.0 SP5, COM, DCOM, VB.NET Beta 2, Oracle 8
-
Apr 15th, 2004, 09:14 AM
#4
Thread Starter
Fanatic Member
Whoops
That was slightly different to the one I tried and it does actually work, much to my embrassment!
Technically, this would be better...
Code:
ActiveSheet.CheckBoxes.Add(Cells(1,2).Left, Cells(1, 2).Top, 10, 10).Select
Thanks again.
Mindcrime : )
ICQ 24003332
VB 5.0, VB 6.0 SP5, COM, DCOM, VB.NET Beta 2, Oracle 8
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|