Auto Shape color change - conditions met

Elfkin

New Member
Joined
Jun 18, 2010
Messages
4
:eek:
I have a job status board that I would like to use an Autoshape arrow and have it turn green once 4 checkboxes have all been selected. This is over and above my one line code abilities.
I currently am using Excel 2010 and the Active X control checkboxes.

Any assistance would be greatly appreciated!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I'm not sure that this is exactly what you're looking for, but assuming that Sheet1 contains the four ActiveX CheckBoxes and the arrow AutoShape, try the following code that needs to be place in the code module for Sheet1 (right-click the sheet tab for Sheet1, and select View Code). Note that the arrow will turn green when all four CheckBoxes are checked. Otherwise, the arrow will turn/remain red (can be changed, if desired).

Code:
[font=Courier New][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]

[color=darkblue]Private[/color] [color=darkblue]Sub[/color] CheckBox1_Click()
    [color=darkblue]Call[/color] UpdateArrow
[color=darkblue]End[/color] [color=darkblue]Sub[/color]

[color=darkblue]Private[/color] [color=darkblue]Sub[/color] CheckBox2_Click()
    [color=darkblue]Call[/color] UpdateArrow
[color=darkblue]End[/color] [color=darkblue]Sub[/color]

[color=darkblue]Private[/color] [color=darkblue]Sub[/color] CheckBox3_Click()
    [color=darkblue]Call[/color] UpdateArrow
[color=darkblue]End[/color] [color=darkblue]Sub[/color]

[color=darkblue]Private[/color] [color=darkblue]Sub[/color] CheckBox4_Click()
    [color=darkblue]Call[/color] UpdateArrow
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] UpdateArrow()

    [color=darkblue]Dim[/color] ChkBoxes [color=darkblue]As[/color] [color=darkblue]Variant[/color]
    [color=darkblue]Dim[/color] ChkBox [color=darkblue]As[/color] [color=darkblue]Variant[/color]
    [color=darkblue]Dim[/color] MyArrow [color=darkblue]As[/color] Shape
    
    ChkBoxes = Array("CheckBox1", "CheckBox2", "CheckBox3", "CheckBox4") [color=green]'change the CheckBox names, accordingly[/color]
    
    [color=darkblue]Set[/color] MyArrow = Me.Shapes("Up Arrow 1") [color=green]'change the shape name accordingly[/color]
    
    [color=darkblue]For[/color] [color=darkblue]Each[/color] ChkBox [color=darkblue]In[/color] ChkBoxes
        [color=darkblue]If[/color] Me.OLEObjects(ChkBox).Object.Value = [color=darkblue]False[/color] [color=darkblue]Then[/color]
            MyArrow.Fill.ForeColor.RGB = RGB(255, 0, 0) [color=green]'colour red[/color]
            [color=darkblue]Exit[/color] [color=darkblue]Sub[/color]
        [color=darkblue]End[/color] [color=darkblue]If[/color]
    [color=darkblue]Next[/color] ChkBox
    
    MyArrow.Fill.ForeColor.RGB = RGB(0, 176, 80) [color=green]'colour green[/color]
    
[color=darkblue]End[/color] [color=darkblue]Sub[/color]

[/font]
 
Upvote 0
Brilliant! This is amazing! I have really got to learn how to do this.

Thank you, thank you, thank you!
 
Upvote 0

Forum statistics

Threads
1,213,529
Messages
6,114,155
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top