I have 2 private sub in the same ''UserForm1''.
I'm using checkboxes to give me an input or generate a number. I can write in sheet1 or in sheet2 depending of the sub runned.
But if I run the macro in one sheet1, i cannot run the other macro in sheet2.
I will need to manually go in sheet2 to run it.
Here is my code :
Private Sub ToggleButton1_Click()
If CheckBox1.Value = True And CheckBox4.Value = True And CheckBox7.Value = True And CheckBox2.Value = False And CheckBox3.Value = False _
And CheckBox6.Value = False And CheckBox5.Value = False And CheckBox8.Value = False And CheckBox9.Value = False And CheckBox10.Value = False And CheckBox11.Value = False And CheckBox12.Value = False _
And CheckBox13.Value = False And CheckBox14.Value = False And CheckBox15.Value = False Then
Sheets("Sheet2").Range("B4").Select
ActiveCell.EntireRow.Insert shift:=xlDown
Sheets("sheet2").Range("B4:E4").Select
Selection.Borders.Weight = xlThin
Sheets("sheet2").Range("B4").Select
ActiveCell.Value = "=b5+1"
Sheets("sheet2").Range("A4").Select
Selection.Borders.Weight = xlThin
ActiveCell.Value = "E"
End If
Private Sub CheckBox2_Click()
Dim answer As VbMsgBoxResult
Dim addname As String
If CheckBox2.Value = True Then
answer = MsgBox("Voulez-vous saisir le CVR?", vbYesNo)
If answer = vbYes Then
addname = InputBox("Inscrivez le CVR")
Sheets("Sheet4").Range("B4").Select
ActiveCell.EntireRow.Insert shift:=xlDown
Sheets("sheet4").Range("B4:E4").Select
Selection.Borders.Weight = xlThin
Sheets("sheet4").Range("A4").Select
Selection.Borders.Weight = xlThin
ActiveCell.Value = addname
Else
Exit Sub
End If
End If
End Sub