Results 1 to 4 of 4

Thread: Checkbox in Worksheet Cell

  1. #1

    Thread Starter
    Fanatic Member Mindcrime's Avatar
    Join Date
    Jun 2001
    Location
    Peterborough, UK
    Posts
    555

    Angry 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

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    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
    -------------------------------

  3. #3

    Thread Starter
    Fanatic Member Mindcrime's Avatar
    Join Date
    Jun 2001
    Location
    Peterborough, UK
    Posts
    555
    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

  4. #4

    Thread Starter
    Fanatic Member Mindcrime's Avatar
    Join Date
    Jun 2001
    Location
    Peterborough, UK
    Posts
    555


    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
  •  



Click Here to Expand Forum to Full Width