VBA to check if shapes are white or not when opening the file.

danbates

Active Member
Joined
Oct 8, 2017
Messages
377
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Please could someone help me?

I would like a code that can check what colour certain shapes are when the file is opened? I can't find anything online that is close enough to what I would like, so that's why I am struggling.

So if the shapes are not all white then I get a message box saying "No" and if they are all white then it says "Yes"

My shapes are called Clean_0 to Clean_17

Any help would be appreciated.

Thanks

Dan
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Perhaps put this in a standard module and call it from the wb open event or just put the code in that event (without the sub end sub lines of course). Untested:
VBA Code:
Sub checkShapeColor()
Dim i As Integer, intWhite As Integer

For i = 0 To 17
     If Sheets("Sheet 3").Shapes("Clean_" & i).Fill.ForeColor = vbWhite Then intWhite = intWhite + 1
Next

If intWhite <> 18 Then
     MsgBox "No"
Else
     MsgBox "Yes"
End If

End Sub
Use your sheet name of course.
 
Upvote 0
Solution
Glad I could help & thanks for the recognition.
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,232
Members
449,092
Latest member
SCleaveland

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