Private Sub CommandButton1_Click()
'On Error Resume Next
Dim Pdt As Worksheet
Dim DoSup As Worksheet
Dim fichier As String
Dim n As Integer
Dim wkbSource As Workbook
Dim wkbCible As Workbook
Dim ws As Worksheet, x&, i&, j&, k&, L&, a, nom As String
Application.ScreenUpdating = False
fichier = ThisWorkbook.Path
Set wkbSource = ThisWorkbook 'ThisWorkbook signifie le classeur de ma macro
Set FD = Application.FileDialog(msoFileDialogOpen)
With FD
fichier = ThisWorkbook.Path
.Title = "Choisissez le Fichier que Vous Souhaitez Mettre à Jour"
.InitialFileName = fichier & "\*"
.Filters.Clear
.Filters.Add "Fichier Excel", "*.xls"
.AllowMultiSelect = False
If .Show <> 0 Then
nom = .SelectedItems(1)
Else
MsgBox "Vous n'avez aucun fichier dans votre dossier", , "Manque de Fichier"
End If
End With
Set DoSup = wkbSource.Worksheets("donnees_supprimees")
Set wkbSource = ThisWorkbook 'ThisWorkbook signifie le classeur de ma macro
Set wkbCible = Workbooks.Open(nom)
Set Pdt = wkbCible.Worksheets("PDT")
Application.Workbooks(1).Activate
'MsgBox "nom du classeuractif " & ActiveWorkbook.Name ''''' doit etre classeur de mon USF
DoSup.Activate
For n = 2 To Range("I65536").End(xlUp).Row
Set c = Pdt.Columns("I").Find(DoSup.Range("I" & n), LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
Ligne = c.Row
Pdt.Cells(Ligne, 1).EntireRow.Delete
End If
Next n
MsgBox " fichier nettoyé"
Unload UserForm1
End Sub