bonjour le forum
je me retrouve avec une erreur bien connu pour certain, la 1004 en mode partage sur la macro suivante:
D’où ma question, existe t il une solution.
merci a tous
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If UCase(Right(ActiveSheet.Name, 4)) <> "PROG" Then Exit Sub
a = Split(ActiveSheet.Name, "-")
nf = a(0) & "- agent"
col = Target.Column
If Not Intersect(Target, Range("A3:g23")) Is Nothing And Target.Count = 1 Then
Set d = CreateObject("Scripting.Dictionary")
For Each c In Sheets(nf).Range("c4:c130").Offset(, col - 1)
If c.Value <> "" Then d(c.Value) = ""
Next c
If d.Count > 0 Then
b = d.keys
Call tri(b, LBound(b), UBound(b))
Target.Validation.Delete
Target.Validation.Add xlValidateList, Formula1:=Join(b, ",")
End If
End If
End Sub
Sub tri(a, gauc, droi) ' Quick sort
ref = a((gauc + droi) \ 2)
g = gauc: d = droi
Do
Do While a(g) < ref: g = g + 1: Loop
Do While ref < a(d): d = d - 1: Loop
If g <= d Then
temp = a(g): a(g) = a(d): a(d) = temp
g = g + 1: d = d - 1
End If
Loop While g <= d
If g < droi Then Call tri(a, g, droi)
If gauc < d Then Call tri(a, gauc, d)
End Sub