Excel/VBA solution


I have an activeX checkbox on a worksheet and need to change the backcolor to a custom color. This code isn't giving me the results.. do you have any suggestions?

Dim sh1 As Worksheet
Set sh1 = Workbooks("Workbook.xlsm").Worksheets("Sheet1")
   sh1.Shapes("CheckBox1").Fill.BackColor.RGB = RGB(64, 64, 64)

Also, is it possible to set the backcolor of a checkbox to a color with a pattern?(ex. background colors in cells can be patterned with stripes, crosshatch, ect)

Thanks for the help,

ANSWER: Jesse,

You need to work with the object itself - not the shape.  This worked for me.

Sub ABC()
Dim sh1 As Worksheet
Set sh1 = ActiveWorkbook.Worksheets("Sheet1")
sh1.OLEObjects("CheckBox1").Object.BackColor = RGB(64, 64, 64)
End Sub

Color with a pattern - No.  Cells are part of the Excel object model and activeX controls are in the MSForms object model.  But besides that, even though you can do it in cells, it isn't necessarily supported by any object that can be colored.

You might be able to put a picture in the checkbox to achieve something like the effect you want.

If you go into design mode and right click on the checkbox and select properties, one of the properties is "picture"  If you have a picture copied in the clipboard, you can click in that property and do ctrl+v  and the picture will display in the control.

It covered up the caption for me however.  

Tom Ogilvy

[an error occurred while processing this directive]---------- FOLLOW-UP ----------

QUESTION: Thanks Tom,
As for the pattern checkbox, is it possible to make the backcolor transparent? I know this is an option in VB but I haven't seen it in VBA.


In the properties list for the checkbox is the BackStyles property.  It has two choices

0  - transparent
1  - Opaque

so this made checkbox1 to have a transparent background:

Sub ABC1()
Dim sh1 As Worksheet
Set sh1 = ActiveWorkbook.Worksheets("Sheet1")
sh1.OLEObjects("CheckBox1").Object.BackStyle = 0
End Sub

Hope that helps.  ( = 1 makes it opaque)

Tom Ogilvy

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Tom Ogilvy


Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]


Extensive experience.

Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2017 About.com. All rights reserved.

[an error occurred while processing this directive]