Bonjour à tous. J’ai une macro qui supprime la dernière ligne d’un tableau en fonction de la taille du tableau, elle fonctionne bien. Mais je voudrais que la suppression soit impossible si la dernière ligne du tableau est la première et qu'une msgbox apparaisse. La première ligne de mon tableau commence à la ligne 13 du fichier Excel.
Ci-dessous ma macro, mais elle ne fonctionne pas. Quelqu’un pourrait-il m’orienté vers la solution.
Sub SupLigneIII()
'
Dim Derligne As Long
Range("B13").Select
Selection.End(xlDown).Select
Derligne = ActiveCell.Row
If Range("B" & Derligne).Value = Rows("13:13") Then
MsgBox "Impossible de supprimer la ligne", vbExclamation, "Supprimer ligne"
Else
Range("B" & Derligne).Select
Selection.EntireRow.Delete
Range("B7").Select
End If
End Sub
Merci
Ci-dessous ma macro, mais elle ne fonctionne pas. Quelqu’un pourrait-il m’orienté vers la solution.
Sub SupLigneIII()
'
Dim Derligne As Long
Range("B13").Select
Selection.End(xlDown).Select
Derligne = ActiveCell.Row
If Range("B" & Derligne).Value = Rows("13:13") Then
MsgBox "Impossible de supprimer la ligne", vbExclamation, "Supprimer ligne"
Else
Range("B" & Derligne).Select
Selection.EntireRow.Delete
Range("B7").Select
End If
End Sub
Merci