1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| Sub forum()
'
' forum Macro
'
Dim Ligne, Colonne, boucle, Ligne_courante As Integer
Dim CA As String
Dim BILAN, DATA As Worksheet
Set BILAN = Application.ActiveWorkbook.Worksheets("Bilan")
Set DATA = Application.ActiveWorkbook.Worksheets("DATA")
Ligne_courante = Range("B" & Rows.Count).End(xlUp).Row + 1
'Balayage de Data
For Ligne = 2 To DATA.UsedRange.Rows.Count
'Deux Conditions pour executer la macro:LE TOTAL RAJOUTE (Col AD est different de 0 et Il faut que "TOTAL" soit ecrit en B)
If (DATA.Cells(Ligne, 30)) <> 0 And (DATA.Cells(Ligne, 2)) = "TOTAL" Then
For Colonne = 4 To DATA.UsedRange.Columns.Count
boucle = 1
'Typage des mois
If boucle = 1 Then
'DATE
BILAN.Cells(Ligne_courante, 1) = DATA.Cells(1, Colonne)
'CA
BILAN.Cells(Ligne_courante, 2) = DATA.Cells(Ligne, 1)
'Montants
BILAN.Cells(Ligne_courante, 3) = DATA.Cells(Ligne, Colonne)
Ligne_courante = Ligne_courante + 1
End If
Next Colonne
End If
Next Ligne
End Sub |
Partager