Sub Supprimer()
Dim ws As Worksheet
Dim id As String
Dim found As Range
Dim confirmation As VbMsgBoxResult
Set ws = [Link]("Dashboard") ' <-- CORRIGE : sheetq devient Sheets
id = [Link]("D8").Value
If id = "" Then
MsgBox "Veuillez entrer un ID.", vbExclamation
Exit Sub
End If
Set found = [Link]("B21:B" & [Link]).Find(id, LookIn:=xlValues, LookAt:=xlWhole)
If Not found Is Nothing Then
confirmation = MsgBox("Etes vous sur de vouloir supprimer cet enregistrement?", vbYesNo +
vbQuestion, "Confirmation")
If confirmation = vbYes Then
[Link]([Link]).Delete ' Supprime toute la ligne
MsgBox "L'enregistrement a été supprimé avec succès.", vbInformation
Else
MsgBox "Suppression annulée.", vbInformation
Exit Sub
End If
' Vider le formulaire
[Link]("D8,D10,D12,D14,D16,G8,G10,G12,G14,G16").ClearContents
photopath = ""
[Link]("PhotoShape").[Link] ' <-- CHANGE "PhotoShape" si ton nom est différent
Call AddNewID ' Prépare le nouvel ID
Else
MsgBox "Enregistrement introuvable.", vbExclamation
End If
End Sub