Good Afternoon!
I want to change the command button background color, the font size, and make it bold when clicked, and have it remain that color until another button in that particular group of Command Buttons is clicked.
There are three groups on the same sheet.
Basically, if a button in Group A, "SepGB" is clicked, it will change from RGB(0, 50, 110), 9 font, and not bolded to RGB(79, 129, 189), 10 font, and bold and if another button in Group A is clicked, "SepGB" will return to RGB(0, 50, 110), 9 font, and not bolded. HOWEVER, if a button from Groups B or C is clicked, "SepGB" will remain RGB(79, 129, 189), 10 font, and bolded.
The code below is working. It sets it so that every time a button is clicked, the others return to their original state. However, doing this for all 37 command buttons seems tedious (and makes the module huge). The groupings are below the code.
Any ideas are greatly appreciated!
--------------------------------------------------
Private Sub SepGB_Click()
ActiveSheet.Shapes("SepGB_Chart").ZOrder msoBringToFront
ActiveSheet.SepGB.BackColor = RGB(79, 129, 189)
ActiveSheet.SepGB.Font.Bold = True
ActiveSheet.SepGB.Font.Size = 10
ActiveSheet.OctGB.BackColor = RGB(0, 50, 110)
ActiveSheet.OctGB.Font.Bold = False
ActiveSheet.OctGB.Font.Size = 9
ActiveSheet.NovGB.BackColor = RGB(0, 50, 110)
ActiveSheet.NovGB.Font.Bold = False
ActiveSheet.NovGB.Font.Size = 9
ActiveSheet.DecGB.BackColor = RGB(0, 50, 110)
ActiveSheet.DecGB.Font.Bold = False
ActiveSheet.DecGB.Font.Size = 9
ActiveSheet.JanGB.BackColor = RGB(0, 50, 110)
ActiveSheet.JanGB.Font.Bold = False
ActiveSheet.JanGB.Font.Size = 9
ActiveSheet.FebGB.BackColor = RGB(0, 50, 110)
ActiveSheet.FebGB.Font.Bold = False
ActiveSheet.FebGB.Font.Size = 9
ActiveSheet.MarGB.BackColor = RGB(0, 50, 110)
ActiveSheet.MarGB.Font.Bold = False
ActiveSheet.MarGB.Font.Size = 9
ActiveSheet.AprGB.BackColor = RGB(0, 50, 110)
ActiveSheet.AprGB.Font.Bold = False
ActiveSheet.AprGB.Font.Size = 9
ActiveSheet.MayGB.BackColor = RGB(0, 50, 110)
ActiveSheet.MayGB.Font.Bold = False
ActiveSheet.MayGB.Font.Size = 9
ActiveSheet.JunGB.BackColor = RGB(0, 50, 110)
ActiveSheet.JunGB.Font.Bold = False
ActiveSheet.JunGB.Font.Size = 9
End Sub
Private Sub OctGB_Click()
ActiveSheet.Shapes("OctGB_Chart").ZOrder msoBringToFront
ActiveSheet.OctGB.BackColor = RGB(79, 129, 189)
ActiveSheet.OctGB.Font.Bold = True
ActiveSheet.OctGB.Font.Size = 10
ActiveSheet.SepGB.BackColor = RGB(0, 50, 110)
ActiveSheet.SepGB.Font.Bold = False
ActiveSheet.SepGB.Font.Size = 9
ActiveSheet.NovGB.BackColor = RGB(0, 50, 110)
ActiveSheet.NovGB.Font.Bold = False
ActiveSheet.NovGB.Font.Size = 9
ActiveSheet.DecGB.BackColor = RGB(0, 50, 110)
ActiveSheet.DecGB.Font.Bold = False
ActiveSheet.DecGB.Font.Size = 9
ActiveSheet.JanGB.BackColor = RGB(0, 50, 110)
ActiveSheet.JanGB.Font.Bold = False
ActiveSheet.JanGB.Font.Size = 9
ActiveSheet.FebGB.BackColor = RGB(0, 50, 110)
ActiveSheet.FebGB.Font.Bold = False
ActiveSheet.FebGB.Font.Size = 9
ActiveSheet.MarGB.BackColor = RGB(0, 50, 110)
ActiveSheet.MarGB.Font.Bold = False
ActiveSheet.MarGB.Font.Size = 9
ActiveSheet.AprGB.BackColor = RGB(0, 50, 110)
ActiveSheet.AprGB.Font.Bold = False
ActiveSheet.AprGB.Font.Size = 9
ActiveSheet.MayGB.BackColor = RGB(0, 50, 110)
ActiveSheet.MayGB.Font.Bold = False
ActiveSheet.MayGB.Font.Size = 9
ActiveSheet.JunGB.BackColor = RGB(0, 50, 110)
ActiveSheet.JunGB.Font.Bold = False
ActiveSheet.JunGB.Font.Size = 9
End Sub
--------------------------------------------------------
Group A:
SepGR
OctGB
NovGB
DecGB
JanGB
FebGB
MarGB
AprGB
MayGB
JunGB
Group B:
RL8
RL81
RL82
RL84
RL86
RI8
RI81
RI82
RI85
RI86
RI89
W8
W81
W82
W84
W85
W810
L8
L84
L86
Group C:
Pre
BOY
IA1
MOY
IA2
EOY
Pos
I want to change the command button background color, the font size, and make it bold when clicked, and have it remain that color until another button in that particular group of Command Buttons is clicked.
There are three groups on the same sheet.
Basically, if a button in Group A, "SepGB" is clicked, it will change from RGB(0, 50, 110), 9 font, and not bolded to RGB(79, 129, 189), 10 font, and bold and if another button in Group A is clicked, "SepGB" will return to RGB(0, 50, 110), 9 font, and not bolded. HOWEVER, if a button from Groups B or C is clicked, "SepGB" will remain RGB(79, 129, 189), 10 font, and bolded.
The code below is working. It sets it so that every time a button is clicked, the others return to their original state. However, doing this for all 37 command buttons seems tedious (and makes the module huge). The groupings are below the code.
Any ideas are greatly appreciated!
--------------------------------------------------
Private Sub SepGB_Click()
ActiveSheet.Shapes("SepGB_Chart").ZOrder msoBringToFront
ActiveSheet.SepGB.BackColor = RGB(79, 129, 189)
ActiveSheet.SepGB.Font.Bold = True
ActiveSheet.SepGB.Font.Size = 10
ActiveSheet.OctGB.BackColor = RGB(0, 50, 110)
ActiveSheet.OctGB.Font.Bold = False
ActiveSheet.OctGB.Font.Size = 9
ActiveSheet.NovGB.BackColor = RGB(0, 50, 110)
ActiveSheet.NovGB.Font.Bold = False
ActiveSheet.NovGB.Font.Size = 9
ActiveSheet.DecGB.BackColor = RGB(0, 50, 110)
ActiveSheet.DecGB.Font.Bold = False
ActiveSheet.DecGB.Font.Size = 9
ActiveSheet.JanGB.BackColor = RGB(0, 50, 110)
ActiveSheet.JanGB.Font.Bold = False
ActiveSheet.JanGB.Font.Size = 9
ActiveSheet.FebGB.BackColor = RGB(0, 50, 110)
ActiveSheet.FebGB.Font.Bold = False
ActiveSheet.FebGB.Font.Size = 9
ActiveSheet.MarGB.BackColor = RGB(0, 50, 110)
ActiveSheet.MarGB.Font.Bold = False
ActiveSheet.MarGB.Font.Size = 9
ActiveSheet.AprGB.BackColor = RGB(0, 50, 110)
ActiveSheet.AprGB.Font.Bold = False
ActiveSheet.AprGB.Font.Size = 9
ActiveSheet.MayGB.BackColor = RGB(0, 50, 110)
ActiveSheet.MayGB.Font.Bold = False
ActiveSheet.MayGB.Font.Size = 9
ActiveSheet.JunGB.BackColor = RGB(0, 50, 110)
ActiveSheet.JunGB.Font.Bold = False
ActiveSheet.JunGB.Font.Size = 9
End Sub
Private Sub OctGB_Click()
ActiveSheet.Shapes("OctGB_Chart").ZOrder msoBringToFront
ActiveSheet.OctGB.BackColor = RGB(79, 129, 189)
ActiveSheet.OctGB.Font.Bold = True
ActiveSheet.OctGB.Font.Size = 10
ActiveSheet.SepGB.BackColor = RGB(0, 50, 110)
ActiveSheet.SepGB.Font.Bold = False
ActiveSheet.SepGB.Font.Size = 9
ActiveSheet.NovGB.BackColor = RGB(0, 50, 110)
ActiveSheet.NovGB.Font.Bold = False
ActiveSheet.NovGB.Font.Size = 9
ActiveSheet.DecGB.BackColor = RGB(0, 50, 110)
ActiveSheet.DecGB.Font.Bold = False
ActiveSheet.DecGB.Font.Size = 9
ActiveSheet.JanGB.BackColor = RGB(0, 50, 110)
ActiveSheet.JanGB.Font.Bold = False
ActiveSheet.JanGB.Font.Size = 9
ActiveSheet.FebGB.BackColor = RGB(0, 50, 110)
ActiveSheet.FebGB.Font.Bold = False
ActiveSheet.FebGB.Font.Size = 9
ActiveSheet.MarGB.BackColor = RGB(0, 50, 110)
ActiveSheet.MarGB.Font.Bold = False
ActiveSheet.MarGB.Font.Size = 9
ActiveSheet.AprGB.BackColor = RGB(0, 50, 110)
ActiveSheet.AprGB.Font.Bold = False
ActiveSheet.AprGB.Font.Size = 9
ActiveSheet.MayGB.BackColor = RGB(0, 50, 110)
ActiveSheet.MayGB.Font.Bold = False
ActiveSheet.MayGB.Font.Size = 9
ActiveSheet.JunGB.BackColor = RGB(0, 50, 110)
ActiveSheet.JunGB.Font.Bold = False
ActiveSheet.JunGB.Font.Size = 9
End Sub
--------------------------------------------------------
Group A:
SepGR
OctGB
NovGB
DecGB
JanGB
FebGB
MarGB
AprGB
MayGB
JunGB
Group B:
RL8
RL81
RL82
RL84
RL86
RI8
RI81
RI82
RI85
RI86
RI89
W8
W81
W82
W84
W85
W810
L8
L84
L86
Group C:
Pre
BOY
IA1
MOY
IA2
EOY
Pos