Bonjour,
j'ai un problème concernant l'addition de plages dans une liste. Je m'explique:
J'ai un tableau Excel dans lequel j'ai alloué une plage pour une personne. J'aimerais avoir la possibilité de manier les plages afin d'en ajouter pour une même personne :
'adapter les plages...
TblPlage = Array("A1:D10", "A11:D20", "A21:D30", "A31:D40", "A41:D50")
'aux utilisateurs correspondants
TblUtilisateur = Array("Personne1", "Personne2", "Personne3", "Personne4", "Personne5")
Par exemple, pour Personne1, ça donnerait : Array("A1:D10" & "U5:V6", ...
Voici un peu plus de code :
Private Function Utilisateur(Cel As Range) As String
Dim TblPlage
Dim TblUtilisateur
Dim I As Integer
'adapter les plages...
TblPlage = Array("A1:D10", "A11:D20", "A21:D30", "A31:D40", "A41:D50")
'aux utilisateurs correspondants
TblUtilisateur = Array("Personne1", "Personne2", "Personne3", "Personne4", "Personne5")
For I = 0 To UBound(TblPlage)
If Not Intersect(Cel, Range(TblPlage(I))) Is Nothing Then
Utilisateur = TblUtilisateur(I)
Exit For
End If
Next I
If Utilisateur = "" Then Utilisateur = "INCONNU (HORS PLAGES)"
End Function
Si quelqu'un pouvait m'aider sur ce sujet, je lui en serais très reconnaissant.
Merci pour votre aide !