Bonjour
je suis en train de programmer un système de comparaison de valeur et update si besoin était.
j'ai une valeur staff_WP qui peut aller de 1 à10
a l'heure actuelle je n'ai comparé que les valeurs pour staff_WP = 1
If (staff_WP = "1") Then
If (get_total_heurs_WP1 <> Staff_hours) Then
answer = MsgBox("Update? " & Staff_hours & " to " & get_total_heurs_WP1, vbQuestion _
+ vbYesNo + vbDefaultButton2, "Confirmation")
If answer = vbYes Then
Sheets("Staff").Range("I" & maligne).Value = get_total_heurs_WP1
End If
End If
If (get_total_pm_WP1 <> Staff_pm) Then
answer = MsgBox("Update? " & Staff_pm & " to " & get_total_pm_WP1, vbQuestion _
+ vbYesNo + vbDefaultButton2, "Confirmation")
If answer = vbYes Then
Sheets("Staff").Range("J" & maligne).Value = get_total_pm_WP1
End If
End If
If (get_valorisation_WP1 <> Staff_valorisation) Then
answer = MsgBox("Update? " & Staff_valorisation & " to " & get_valorisation_WP1, vbQuestion _
+ vbYesNo + vbDefaultButton2, "Confirmation")
If answer = vbYes Then
Sheets("Staff").Range("K" & maligne).Value = get_valorisation_WP1
End If
End If
End If
mais au lieu de dupliquer ce code 10 fois en ajustant les variables à récupérer je me demande si pas possible de procéder de façon plus adapté avec style
For i = 1 To 10
If (staff_WP = i) Then
End If
Next
mais aussi comment adapter la récupération de variable selon I
get_total_heurs_WP1 en get_total_heurs_WP & i
merci par avance pour votre aide
ps: j'ai tenté de mon coté mais
get_total_heurs_WP & i n'est pas correct