maninwhite
XLDnaute Occasionnel
Bonjour à toutes et à tous
Je reviens vers vous afin d'obtenir de l'aide pour la simplification des deux codes ci dessous.
Je pense que par exemple pour le deuxième code un "select case" serait plus approprié.
Merci pour votre aide
Je reviens vers vous afin d'obtenir de l'aide pour la simplification des deux codes ci dessous.
Je pense que par exemple pour le deuxième code un "select case" serait plus approprié.
Merci pour votre aide
Code:
'Remplir colonne ok
Cells(3, col_semaine) = Cells(3, col_semaine) + ComboBox_comportement_ok_admin1
Cells(4, col_semaine) = Cells(4, col_semaine) + ComboBox_comportement_ok_admin2
Cells(5, col_semaine) = Cells(5, col_semaine) + ComboBox_comportement_ok_admin3
Cells(6, col_semaine) = Cells(6, col_semaine) + ComboBox_comportement_ok_admin4
Cells(7, col_semaine) = Cells(7, col_semaine) + ComboBox_comportement_ok_admin5
'Remplir colonne nok
Cells(3, col_semaine + 1) = Cells(3, col_semaine + 1) + ComboBox_comportement_nok_admin1
Cells(4, col_semaine + 1) = Cells(4, col_semaine + 1) + ComboBox_comportement_nok_admin2
Cells(5, col_semaine + 1) = Cells(5, col_semaine + 1) + ComboBox_comportement_nok_admin3
Cells(6, col_semaine + 1) = Cells(6, col_semaine + 1) + ComboBox_comportement_nok_admin4
Cells(7, col_semaine + 1) = Cells(7, col_semaine + 1) + ComboBox_comportement_nok_admin5
'Remplir colonne feedback positif
Cells(3, col_semaine + 2) = Cells(3, col_semaine + 2) + ComboBox_feedback_positif_admin1
Cells(4, col_semaine + 2) = Cells(4, col_semaine + 2) + ComboBox_feedback_positif_admin2
Cells(5, col_semaine + 2) = Cells(5, col_semaine + 2) + ComboBox_feedback_positif_admin3
Cells(6, col_semaine + 2) = Cells(6, col_semaine + 2) + ComboBox_feedback_positif_admin4
Cells(7, col_semaine + 2) = Cells(7, col_semaine + 2) + ComboBox_feedback_positif_admin5
'Remplir colonne feedback positif
Cells(3, col_semaine + 3) = Cells(3, col_semaine + 3) + ComboBox_feedback_constructif_admin1
Cells(4, col_semaine + 3) = Cells(4, col_semaine + 3) + ComboBox_feedback_constructif_admin2
Cells(5, col_semaine + 3) = Cells(5, col_semaine + 3) + ComboBox_feedback_constructif_admin3
Cells(6, col_semaine + 3) = Cells(6, col_semaine + 3) + ComboBox_feedback_constructif_admin4
Cells(7, col_semaine + 3) = Cells(7, col_semaine + 3) + ComboBox_feedback_constructif_admin5
Code:
If TextBox_service_associe = "A" Then
With Sheets("Ad")
With .Cells(.Range("A:A").Find(TextBox_date).Row, .Range("1:1").Find(TextBox_nom_prenom).Column)
If .Value = "" Then
.Value = "1"
Else
.Value = .Value + 1
End If
End With
End With
End If
If TextBox_service_associe = "L" Then
With Sheets("L")
With .Cells(.Range("A:A").Find(TextBox_date).Row, .Range("1:1").Find(TextBox_nom_prenom).Column)
If .Value = "" Then
.Value = "1"
Else
.Value = .Value + 1
End If
End With
End With
End If
If TextBox_service_associe = "M" Then
With Sheets("M")
With .Cells(.Range("A:A").Find(TextBox_date).Row, .Range("1:1").Find(TextBox_nom_prenom).Column)
If .Value = "" Then
.Value = "1"
Else
.Value = .Value + 1
End If
End With
End With
End If
If TextBox_service_associe = "P" Then
With Sheets("")
With .Cells(.Range("A:A").Find(TextBox_date).Row, .Range("1:1").Find(TextBox_nom_prenom).Column)
If .Value = "" Then
.Value = "1"
Else
.Value = .Value + 1
End If
End With
End With
End If
If TextBox_service_associe = "" Then
With Sheets("Qualité")
With .Cells(.Range("A:A").Find(TextBox_date).Row, .Range("1:1").Find(TextBox_nom_prenom).Column)
If .Value = "" Then
.Value = "1"
Else
.Value = .Value + 1
End If
End With
End With
End If
If TextBox_service_associe = "" Then
With Sheets("TSM")
With .Cells(.Range("A:A").Find(TextBox_date).Row, .Range("1:1").Find(TextBox_nom_prenom).Column)
If .Value = "" Then
.Value = "1"
Else
.Value = .Value + 1
End If
End With
End With
End If