[Résolu]Macro Supprimer Cellules non vide +

  • Initiateur de la discussion Initiateur de la discussion Asus13x11
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Asus13x11

XLDnaute Nouveau
Bonjour

Je sollicite votre connaissance par mon ignorance, lol.

Voilà mon PB :

Je cherche a faire une macro qui :
si les cellules de (H7:AT7) sont non vide les supprimer + supprimer la cellule haut dessus.

Cdt
 

Pièces jointes

Dernière édition:
Re : Macro Supprimer Cellules non vide +

Bonjour

vider les cellules, et H7:AS7 oui tu as raison désolé

exemple : en H7 j'ai une date que je doit vider + celle du dessus H6 tous ça sur toute la ligne

mais si la cellule H7 est vide ne pas vider la cellule H6


A+
 

Pièces jointes

Dernière édition:
Re : Macro Supprimer Cellules non vide +

J'ai trouvé mais un peu chaotique !! non ?
il n'y aurais pas plus propre SVP !

Merci



Sub Macro2()
'
' Macro2 Macro
'

'
Sheets("Feuil2").Select
Rows("6:7").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Sheets("Feuil1").Select
Rows("6:7").Select
Selection.Copy
Sheets("Feuil2").Select
Rows("8:9").Select
ActiveSheet.Paste
Range("B7").Select
Sheets("Feuil1").Select

If Not IsEmpty(Range("H7")) Then
Range("H7").ClearContents
Range("H6").ClearContents
If Not IsEmpty(Range("H7")) Then
Range("I7").ClearContents
Range("I6").ClearContents
If Not IsEmpty(Range("H7")) Then
Range("J7").ClearContents
Range("J6").ClearContents

If Not IsEmpty(Range("L7")) Then
Range("L7").ClearContents
Range("L6").ClearContents
If Not IsEmpty(Range("M7")) Then
Range("M7").ClearContents
Range("M6").ClearContents
If Not IsEmpty(Range("N7")) Then
Range("N7").ClearContents
Range("N6").ClearContents
If Not IsEmpty(Range("O7")) Then
Range("O7").ClearContents
Range("O6").ClearContents
If Not IsEmpty(Range("P7")) Then
Range("P7").ClearContents
Range("P6").ClearContents
If Not IsEmpty(Range("Q7")) Then
Range("Q7").ClearContents
Range("Q6").ClearContents

If Not IsEmpty(Range("S7")) Then
Range("S7").ClearContents
Range("S6").ClearContents
If Not IsEmpty(Range("T7")) Then
Range("T7").ClearContents
Range("T6").ClearContents
If Not IsEmpty(Range("U7")) Then
Range("U7").ClearContents
Range("U6").ClearContents
If Not IsEmpty(Range("V7")) Then
Range("V7").ClearContents
Range("V6").ClearContents
If Not IsEmpty(Range("W7")) Then
Range("W7").ClearContents
Range("W6").ClearContents

If Not IsEmpty(Range("Y7")) Then
Range("Y7").ClearContents
Range("Y6").ClearContents
If Not IsEmpty(Range("Z7")) Then
Range("Z7").ClearContents
Range("Z6").ClearContents
If Not IsEmpty(Range("AA7")) Then
Range("AA7").ClearContents
Range("AA6").ClearContents
If Not IsEmpty(Range("AB7")) Then
Range("AB7").ClearContents
Range("AB6").ClearContents

If Not IsEmpty(Range("AD7")) Then
Range("AD7").ClearContents
Range("AD6").ClearContents
If Not IsEmpty(Range("AE7")) Then
Range("AE7").ClearContents
Range("AE6").ClearContents
If Not IsEmpty(Range("AF7")) Then
Range("AF7").ClearContents
Range("AF6").ClearContents

If Not IsEmpty(Range("AH7")) Then
Range("AH7").ClearContents
Range("AH6").ClearContents
If Not IsEmpty(Range("AI7")) Then
Range("AI7").ClearContents
Range("AI6").ClearContents
If Not IsEmpty(Range("AJ7")) Then
Range("AJ7").ClearContents
Range("AJ6").ClearContents

If Not IsEmpty(Range("AL7")) Then
Range("AL7").ClearContents
Range("AL6").ClearContents
If Not IsEmpty(Range("AM7")) Then
Range("AM7").ClearContents
Range("AM6").ClearContents
If Not IsEmpty(Range("AN7")) Then
Range("AN7").ClearContents
Range("AN6").ClearContents

If Not IsEmpty(Range("AP7")) Then
Range("AP7").ClearContents
Range("AP6").ClearContents
If Not IsEmpty(Range("AQ7")) Then
Range("AQ7").ClearContents
Range("AQ6").ClearContents
If Not IsEmpty(Range("AR7")) Then
Range("AR7").ClearContents
Range("AR6").ClearContents
If Not IsEmpty(Range("AS7")) Then
Range("AS7").ClearContents
Range("AS6").ClearContents


End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
Application.CutCopyMode = False
Range("D6:E7").Select

End Sub
 
Re : Macro Supprimer Cellules non vide +

Bonjour,

Avec quelques données pour tester cela aurait été mieux.

Macro non testée
Code:
Sub Macro3()
'Parcourir toutes les cellules des Tableaux de H7 à AS7
Dim c As Range
    With Sheets("Feuil1")
        For Each c In .Range("$H$7:$J$7,$L$7:$Q$7,$S$7:$W$7,$Y$7:$AB$7,$AD$7:$AF$7,$AH$7:$AJ$7,$AL$7:$AN$7,$AP$7:$AS$7")
            If c.Value <> "" Then
                c = ""
                c(0, 1) = ""
            End If
        Next
    End With
End Sub



A+
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
10
Affichages
619
Réponses
4
Affichages
243
Réponses
9
Affichages
508
  • Question Question
XL 2021 Macro
Réponses
6
Affichages
313
Retour