Ancient Wolf
Board Regular
- Joined
- Mar 17, 2009
- Messages
- 89
Hello again MrExcel.
I searched the forum, but could not find anything for this issue. I hope you can help.
This time, I am needing to add coding to some macro controlled shapes serving as buttons that will count each time each button has been clicked on.
Right now, I have not specified any location where the counts will be stored. Most likely on a separate sheet that will be hidden when not in use. I also have some coding in the buttons that color the buttons when they are first clicked on, and another button that clears the coloring of each button. I don't know if that would affect the counting so I included the codes just in case.
Changes individual buttons
Dim oShape As Shape
Set oShape = ActiveSheet.Shapes(Application.Caller)
If oShape.Fill.ForeColor.RGB = RGB(255, 0, 0) Then
oShape.Fill.ForeColor.RGB = RGB(0, 0, 255)
Else
oShape.Fill.ForeColor.RGB = RGB(255, 0, 0)
End If
Changes all buttons
Dim oShape As Shape
For Each oShape In ActiveSheet.Shapes
If oShape.Fill.ForeColor.RGB = RGB(255, 0, 0) Then
oShape.Fill.ForeColor.RGB = RGB(0, 0, 255)
End If
Next oShape
I searched the forum, but could not find anything for this issue. I hope you can help.
This time, I am needing to add coding to some macro controlled shapes serving as buttons that will count each time each button has been clicked on.
Right now, I have not specified any location where the counts will be stored. Most likely on a separate sheet that will be hidden when not in use. I also have some coding in the buttons that color the buttons when they are first clicked on, and another button that clears the coloring of each button. I don't know if that would affect the counting so I included the codes just in case.
Changes individual buttons
Dim oShape As Shape
Set oShape = ActiveSheet.Shapes(Application.Caller)
If oShape.Fill.ForeColor.RGB = RGB(255, 0, 0) Then
oShape.Fill.ForeColor.RGB = RGB(0, 0, 255)
Else
oShape.Fill.ForeColor.RGB = RGB(255, 0, 0)
End If
Changes all buttons
Dim oShape As Shape
For Each oShape In ActiveSheet.Shapes
If oShape.Fill.ForeColor.RGB = RGB(255, 0, 0) Then
oShape.Fill.ForeColor.RGB = RGB(0, 0, 255)
End If
Next oShape