1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Sub FicheOrg()
Application.ScreenUpdating = False
Worksheets("Ensemble").Activate
Worksheets("Feuil4").Range("C5:M20000").Delete
Dim c As String, a As String, o As Range
Set FiOrg = ActiveWorkbook.Sheets("Feuil4")
Set BdOLS = ActiveWorkbook.Sheets("Ensemble")
c = FiOrg.Range("A6").Value
'Sélectionner toute les lignes si territoire à exporter
BdOLS.Activate
Range("EPT_Terr").Select
For Each o In Selection
a = o.Row
If o.Value = c And Cells(a, 1) > 0 Then
'Copier la ligne dans formulaire
BdOLS.Range(Cells(a, 2), Cells(a, 8)).Copy
FiOrg.Cells(FiOrg.UsedRange.Rows.Count + 1, 3).PasteSpecial Paste:=xlPasteAll, Transpose:=False
Application.CutCopyMode = False
End If
Next o
Application.ScreenUpdating = False
End Sub |
Partager