Results 1 to 8 of 8

Custom Checkbox control in Excel

Threaded View

  1. #6
    Registered User
    Join Date
    02-13-2014
    Location
    Chicago Land
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Custom Checkbox control in Excel

    Sorry not .Shadow, but .Fill (see code below)

    I also tried to hide the cell's value (true or false) with editing the font color. Better is to control it with conditional formatting while formatting the cell's background color.


    Sub Rectangle_Toggle(Button As Variant)
        With Application.ActiveSheet.Shapes(Button)
        
            'Transparency of the shape 1 = transparent, 0 = solid
            .Fill.Transparency = 1
            'Hides the cell's value
            Range(.TopLeftCell.Address).Font.Color = Range(.TopLeftCell.Address).Interior.Color
            
            If .TextFrame.Characters.Text = "X" Then 'Chr$(252) Then
             .TextFrame.Characters.Text = ""
             .Fill.ForeColor.RGB = RGB(255, 255, 255)
             Range(.TopLeftCell.Address).Value = False
            Else
            .TextFrame.Characters.Text = "X" 'Chr$(252)
            .Fill.ForeColor.RGB = RGB(46, 208, 80)    '(50, 195, 50)  <-- change your color here
            Range(.TopLeftCell.Address).Value = True
            End If
        End With
    End Sub
    Last edited by arlu1201; 02-14-2014 at 01:55 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1