Bonjour à tous,
je me permets de vous solliciter votre aide. J'essaye de créer une macro qui permet de remplir un tableau dans la feuill1 à partir de données issues d'une extraction qui est dans une autre feuille( feuil2). J'aimerais rajouter dans ma macro une session qui me permet de supprimer une ligne complète si une cellule de celle-ci est vide.
Voici ma programmation sans la session voulue :
Sub ajoutdelignesdansletableauAMORTETCB()
variables_tableau
'trier
Sheets("Extration CADOR Immo").Range("B14").Select
Range("B14", Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("Extration CADOR Immo").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Extration CADOR Immo").Sort.SortFields.Add Key:= _
Range("B14:B10000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Extration CADOR Immo").Sort
.SetRange Range("A13:CL10000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.Apply
End With
'Savoir le nombre de ligne dans mon futur tableau
LIGNE = WorksheetFunction.CountA(Columns("B:B")) - 1
Worksheets("AMORT et CB").Rows("10").EntireRow.Resize(rowsize:=LIGNE).Insert shift:=xlDown
For i = 1 To LIGNE
CODE = Sheets("Extration CADOR Immo").Cells(13 + i, 1)
Sheets("AMORT et CB").Cells(9 + i, 2) = CODE
N°COMPTE = Sheets("Extration CADOR Immo").Cells(13 + i, 2)
Sheets("AMORT et CB").Cells(9 + i, 1) = N°COMPTE
DATE_IMMO = Sheets("Extration CADOR Immo").Cells(13 + i, 12)
Sheets("AMORT et CB").Cells(9 + i, 3) = DATE_IMMO
DESIGNATION = Sheets("Extration CADOR Immo").Cells(13 + i, 9)
Sheets("AMORT et CB").Cells(9 + i, 4) = DESIGNATION
VALEUR_HT = Sheets("Extration CADOR Immo").Cells(13 + i, 13)
Sheets("AMORT et CB").Cells(9 + i, 5) = VALEUR_HT
DOTATION_IMMO = Sheets("Extration CADOR Immo").Cells(13 + i, 85)
Sheets("AMORT et CB").Cells(9 + i, 6) = DOTATION_IMMO
Sheets("AMORT et CB").Cells(9 + 1, 12).Formula = "=somme(h10:k10)"
Sheets("AMORT et CB").Cells(9 + 1, 13).Formula = "=si(g10>0;l10/g10;0)"
Sheets("AMORT et CB").Cells(9 + 1, 14).Formula = "=m10*f10"
Sheets("AMORT et CB").Cells(9 + 1, 20).Formula = "=somme(p10:s10)"
Sheets("AMORT et CB").Cells(9 + 1, 21).Formula = "=si(g10>0;t10/g10;0)"
Sheets("AMORT et CB").Cells(9 + 1, 22).Formula = "=u10*f10"
Next
End Sub
J'ai essayé de rajouter cette ligne : Sheets("Extration CADOR Immo").Range("i:i").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
elle fonctionne uniquement si mon extraction contient des des cellules vides dans ma colonne I mais pas quand mon extraction ne comporte pas de vide. Je ne trouve pas la condition qui me permet utiliser cette ligne dans les deux cas.
Je vous remercie pour votre aide.