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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
Sub test()
'RECUPERATION DE MON CLASSEUR COMPTAGE
ceclasseur = ActiveWorkbook.Name
'Récupération fichier
Filt = "Excel Files (*.xls; *.xlsx; *.xlsm),*.xls; *.xlsx; *.xlsm"
Title = "Selectionnez un Fichier Excel a Importer : "
choix = Application.GetOpenFilename(FileFilter:=Filt, Title:=Title)
If choix = False Then
MsgBox "Aucun fichier choisi"
Exit Sub
End If
Workbooks.Open Filename:=choix
nom = Dir(choix)
Workbooks(nom).Activate
Cells.Copy
Workbooks(ceclasseur).Activate
ActiveWorkbook.Worksheets.Add
ActiveSheet.Name = "comptage propublic"
Range("A1").PasteSpecial (xlPasteValues)
Application.DisplayAlerts = False
Workbooks(nom).Close
Application.DisplayAlerts = True
'DEBUT DE MON CODE POUR COMPARAISON
With Worksheets("STOCK").Range("B2:E500")
Set c = .Find("FDC01", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
With Worksheets("comptage propublic").Range("A1:D500")
Set d = .Find(c, LookIn:=xlValues)
If Not d Is Nothing Then
dAddress = d.Address
Do
Set d = .FindNext(d)
Loop While Not d Is Nothing And d.Address <> dAddress
End If
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub |
Partager