Macro VBA

Bonjour je recherche une macro pour supprimer ligne Excel avec suivi des formules. J'ai la macro pour ajout de ligne et maintenant j'aimerais faire le contraire avec un bouton.

ci-joint mon fichier Excel

merci d'avance

Bonjour

à tester bien entendu sélectionner la ligne avant

ci-joint,

ajout d'un autre bouton + affectation de cette macro

Sub aargh1()
    Selection.EntireRow.Delete
    dl = Cells(Rows.Count, "C").End(xlUp).Row + 1
    For col = 3 To 17
        If Cells(12, col).HasFormula Then
           Cells(13, col).AutoFill Destination:=Cells(13, col).Resize(dl - 13), Type:=xlFillDefault
        End If
    Next
End Sub

crdlt

André

Merci le fichier fonctionne très bien sauf quand la feuille est verrouillé y a t'il une solution

merci

Re,

la feuille Désamianté je n'avais pas vu de protection par contre l'onglet Cöef

à placer avant

ActiveSheet.Unprotect "" ' pour déprotéger la feuille active

à placer vers la fin de ma sub

ActiveSheet.Protect "" ' pour Protéger la feuille active

des exemples ici merci à Banzai64 https://forum.excel-pratique.com/viewtopic.php?t=33111

Exemple :

Sub aargh()
ActiveSheet.Unprotect ""
    Selection.EntireRow.Insert xlDown, xlFormatFromLeftOrAbove
    dl = Cells(Rows.Count, "C").End(xlUp).Row + 1
    For col = 3 To 17
        If Cells(12, col).HasFormula Then
           Cells(13, col).AutoFill Destination:=Cells(13, col).Resize(dl - 13), Type:=xlFillDefault
        End If
    Next
    ActiveSheet.Protect ""
End Sub
Sub aargh1()
ActiveSheet.Unprotect ""
    Selection.EntireRow.Delete
    dl = Cells(Rows.Count, "C").End(xlUp).Row + 1
    For col = 3 To 17
        If Cells(12, col).HasFormula Then
           Cells(13, col).AutoFill Destination:=Cells(13, col).Resize(dl - 13), Type:=xlFillDefault
        End If
    Next
        ActiveSheet.Protect ""
End Sub

crdlt,

André

Merci cela fonctionne très bien

Rechercher des sujets similaires à "macro vba"