Salut Wheday,
Salut gmb,
comme gmb, , 1ère partie...
- conversion des valeurs "Prix" à l'ouverture du fichier ;
With Worksheets("BDD")
If InStr(.[F2], ".") > 0 Then
tTab = .Range("F2:H" & .Range("A" & Rows.Count).End(xlUp).Row).Value
For x = 1 To UBound(tTab, 1)
tTab(x, 1) = Val(Replace(tTab(x, 1), ".", ","))
tTab(x, 3) = Val(Replace(tTab(x, 3), ".", ","))
Next
.Columns("F").ClearContents
.Columns("H").ClearContents
.Columns("F").NumberFormat = "0.00 €"
.Columns("H").NumberFormat = "0.00 €"
.Range("F2:H" & Range("A" & Rows.Count).End(xlUp).Row).Value = tTab
End If
End With
- histoire d'alléger le "fonctionnement" de la recherche de la région, un clic en [A1] crée une liste de validation, suffisante pour le besoin ;
Private Sub Worksheet_Change(ByVal Target As Range)
'
Dim iRow1%, iRow2%
'
Application.EnableEvents = False
'
With Range("A1:H" & Range("A" & Rows.Count).End(xlUp).Row)
.Sort _
key1:=Range("E2"), order1:=xlAscending, _
key2:=Range("D2"), order2:=xlAscending, _
Orientation:=xlTopToBottom, Header:=xlYes
.Sort _
key1:=Range("A2"), order1:=xlAscending, _
key2:=Range("B2"), order2:=xlAscending, _
key3:=Range("C2"), order3:=xlAscending, _
Orientation:=xlTopToBottom, Header:=xlYes
End With
Columns.AutoFit
'
If Not Intersect(Target, Range("A1")) Is Nothing Then
Range("A2:H" & Range("A" & Rows.Count).End(xlUp).Row).Interior.Color = xlNone
iRow1 = Columns(1).Find(what:=Target, lookat:=xlWhole, LookIn:=xlValues, searchdirection:=xlNext).Row
iRow2 = Columns(1).Find(what:=Target, lookat:=xlWhole, LookIn:=xlValues, searchdirection:=xlPrevious).Row
Range("A" & iRow1 & ":A" & iRow2).Interior.Color = RGB(110, 190, 245)
ActiveWindow.ScrollRow = iRow1
Target = "REGION"
End If
'
Application.EnableEvents = True
'
End Sub
- coloration des cellules "Région" et ScrollRow vers les lignes ciblées ;
- un double-clic sur la feuille annule la recherche.
La suite au prochain numéro...
Bonne année !
A+