Bonjour,
ci dessous ma macro, j'aimerai la raccourcir avez vous une idée commetn ?
Je pensais faire une boucle sur les frames mais je me demande si la boucle sur les frames s'operera seulement quand la boucle de chaque i sur une frame sera effectuée. Parce que si change de frame en meme temps que de checkbox c'est pas bon.
Private Sub CommandButton1_Click()
With UserForm1
With Frame1
For i = 1 To 11
If .Controls("CheckBox" & i).Value = True Then
Range("B4") = Frame1.Caption
Range("B5") = .Controls("CheckBox" & i).Caption
End If
Next i
End With
With Frame2
For i = 14 To 21
If .Controls("CheckBox" & i).Value = True Then
Range("B4") = Frame2.Caption
Range("B5") = .Controls("CheckBox" & i).Caption
End If
Next i
End With
With Frame3
For i = 22 To 23
If .Controls("CheckBox" & i).Value = True Then
Range("B4") = Frame3.Caption
Range("B5") = .Controls("CheckBox" & i).Caption
End If
Next i
End With
With Frame6
If .Controls("CheckBox24").Value = True Then
Range("B4") = Frame6.Caption
Range("B5") = .Controls("CheckBox24").Caption
End If
End With
With Frame7
If .Controls("CheckBox25").Value = True Then
Range("B4") = Frame7.Caption
Range("B5") = .Controls("CheckBox25").Caption
End If
End With
With Frame8
If .Controls("CheckBox26").Value = True Then
Range("B4") = Frame8.Caption
Range("B5") = .Controls("CheckBox26").Caption
End If
End With
End With
Unload UserForm1
End Sub
Merci pour l'importance que vous accorderez à ma demande.