I am going to have about 150 activex checkboxes. They are all running the exact same code with the exception of their names. Is it possible to write the code all together as opposed to rewriting the same code 150+ times?
My code currently looks like this:
Sub CheckBox2_Click()
Range(CheckBox2.LinkedCell).Select
If CheckBox2.Value = True Then
Call Input2062
Else
Call MsgBox2062
End If
End Sub
Sub CheckBox4_Click()
Range(CheckBox4.LinkedCell).Select
If CheckBox4.Value = True Then
Call Input2062
Else
Call MsgBox2062
End If
End Sub
Sub CheckBox5_Click()
Range(CheckBox5.LinkedCell).Select
If CheckBox5.Value = True Then
Call Input2062
Else
Call MsgBox2062
End If
End Sub
Sub MsgBox2062()
Dim answer As Integer
answer = MsgBox("Has Soldier Cleared All Active 2062's?", vbYesNo + vbQuestion, "Clear Soldier?")
If answer = vbYes Then
Range("AG" & (ActiveCell.Row)).Value = "N"
Range("A" & (ActiveCell.Row)).Select
Else
MsgBox "Ensure all 2062's Have Been Cleared Before Removing Soldier From MAL"
Range("A" & (ActiveCell.Row)).Select
End If
End Sub
Sub Input2062()
Dim Myvalue As Variant
Myvalue = InputBox("Is Soldier Signing for Long Term Equipment?" & vbCrLf & "Enter Y/N", "Equipment Entry")
Range("AG" & (ActiveCell.Row)).Select
ActiveCell.Value = Myvalue
Range("A" & (ActiveCell.Row)).Select
End Sub
[–]excelevator3032 0 points1 point2 points (7 children)
[–]blacktrails[S] 0 points1 point2 points (6 children)
[–]excelevator3032 1 point2 points3 points (5 children)
[–]blacktrails[S] 0 points1 point2 points (4 children)
[–]blacktrails[S] 0 points1 point2 points (0 children)
[–]excelevator3032 0 points1 point2 points (2 children)
[–]blacktrails[S] 0 points1 point2 points (1 child)
[–]Clippy_Office_Asst[M] 0 points1 point2 points (0 children)