Good afternoon,
I have a workbook that has a clear all commandbutton which resets all the checkboxes and comboboxes back to dashes along with clearing numerous cells. This workbook also requests the person who completed it to sign the bottom using the ink pen in excel. Currently with the code below it works great however all of the activex controls randomly resize themselves.
One solution to the resizing issue is to group the controls together; however when I group them and use the delete commandbutton, it deletes all of the control objects. I would like to alter my code so when the controls are grouped it will clear everything from above but keep the controls present.
Please keep in mind I am very basic when it comes to VBA code
Private Sub CheckBox2_Click()
Select Case ComboBox2.Value
Case "1": ComboBox2.BackColor = RGB(255, 0, 0)
Case "2": ComboBox2.BackColor = RGB(0, 255, 0)
Case "3": ComboBox2.BackColor = RGB(0, 0, 255)
Case Else: ComboBox2.BackColor = RGB(242, 247, 252)
End Select
End Sub
Private Sub CheckBox3_Click()
Select Case ComboBox3.Value
Case "1": ComboBox3.BackColor = RGB(255, 0, 0)
Case "2": ComboBox3.BackColor = RGB(0, 255, 0)
Case "3": ComboBox3.BackColor = RGB(0, 0, 255)
Case Else: ComboBox3.BackColor = RGB(242, 247, 252)
End Select
End Sub
Private Sub ComboBox1_Change()
Select Case ComboBox1.Value
Case "1": ComboBox1.BackColor = RGB(255, 0, 0)
Case "2": ComboBox1.BackColor = RGB(0, 255, 0)
Case "3": ComboBox1.BackColor = RGB(0, 0, 255)
Case Else: ComboBox1.BackColor = RGB(242, 247, 252)
End Select
End Sub
Private Sub ComboBox4_Change()
Select Case ComboBox4.Value
Case "1": ComboBox4.BackColor = RGB(255, 0, 0)
Case "2": ComboBox4.BackColor = RGB(0, 255, 0)
Case "3": ComboBox4.BackColor = RGB(0, 0, 255)
Case Else: ComboBox4.BackColor = RGB(242, 247, 252)
End Select
End Sub
Private Sub ComboBox87_Change()
Select Case ComboBox87.Value
Case "1": ComboBox87.BackColor = RGB(255, 0, 0)
Case "2": ComboBox87.BackColor = RGB(0, 255, 0)
Case "3": ComboBox87.BackColor = RGB(0, 0, 255)
Case Else: ComboBox87.BackColor = RGB(242, 247, 252)
End Select
End Sub
Private Sub CommandButton1_Click()
ComboBox2.Text = "-"
ComboBox3.Text = "-"
ComboBox4.Text = "-"
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox3.Value = False
CheckBox4.Value = False
CheckBox5.Value = False
CheckBox8.Value = False
CheckBox9.Value = False
CheckBox10.Value = False
CheckBox11.Value = False
Range("F9:F9").Value = 0
Range("F11:F11").Value = 0
Range("F14:F14").Value = 0
Range("F16:F16").Value = 0
Range("F19:F19").Value = 0
Range("F21:F21").Value = 0
Range("F24:F24").Value = 0
Range("F26:F26").Value = 0
Range("F32:F32").Value = 0
Range("F34:F34").Value = 0
Range("F36:F36").Value = 0
Range("F42:F42").Value = 0
Range("F44:F44").Value = 0
Range("F52:F52").Value = 0
Range("F54:F54").Value = 0
Range("F56:F56").Value = 0
Range("K32:K32").Value = 0
Range("K34:K34").Value = 0
Range("L42:L42").Value = 0
Range("L44:L44").Value = 0
Range("L52:L52").Value = 0
Range("J9:M9").Value = "-"
Range("J14:M14").Value = "-"
Range("J19:M19").Value = "-"
Range("J24:M24").Value = "-"
Dim Shp As Shape
For Each Shp In ActiveSheet.Shapes
If Not (Shp.Type = msoOLEControlObject Or Shp.Type = msoFormControl Or
Shp.Type = msoPicture) Then Shp.Delete
Next Shp
End Sub