Merci de m'aider..
voila la macro super qui fonctionne super bien
Sub test()
Dim DerCol As Integer, DerLig As Integer, i As Integer
DerCol = Range("b2").End(xlToRight).Column
DerLig = Range("a3").End(xlDown).Row
For i = 3 To DerLig - 2
Worksheets("Feuil1").Cells(i, DerCol).FormulaLocal = "=NBVAL(L" & i & "C2:L" & i & "C" & DerCol - 1 & ")"
Next
For i = 2 To DerCol - 1
Worksheets("Feuil1").Cells(DerLig - 1, i).FormulaLocal = "=NBVAL(L3C" & i & ":L" & DerLig - 2 & "C" & i & ")"
Next
For i = 3 To DerCol - 1
Worksheets("Feuil1").Cells(DerLig, i).FormulaLocal = "=L" & DerLig - 1 & "C2+L" & DerLig - 1 & "C" & i
Next
End Sub
et voila ce que j'en ai fait.. mais la 1ère de tes boucles limite à la colonne J, il peux y avoir plus ou moins de colonnes
Sub créationpour_tableauPHOTO()
Dim nom(50)
Dim DerCol As Integer, DerLig As Integer, i As Integer
Sheets("LISTE").Select
If Range("E1") = 0 Then End
xlA = Range("A" & Cells.Rows.Count).End(xlUp).Row
cpt = 1
nom(cpt) = "Commun"
For v = 2 To xlA
If Range("D" & v) <> "" Then
cpt = cpt + 1
nom(cpt) = Range("A" & v)
End If
Next
nb = Val(InputBox("un nombre", "Combien de Photos/Vidéo"))
Sheets("listephotos").Select
Cells.ClearContents
Cells.Select
Selection.UnMerge
Range("A1").Select
For v = 1 To cpt
Cells(2, v + 1) = nom(v)
Next
nbcol = Cells(2, Columns.Count).End(xlToLeft).Column
Cells(2, cpt + 2) = "TOTAL"
Range("B1" & Cells(1, cpt - 2)).Select
Selection.Merge
For j = 100 To nb * 100 Step 100
Range("A" & (j / 100) + 2) = j
Next
xlA = 1 + Range("A" & Cells.Rows.Count).End(xlUp).Row
Range("A" & xlA) = "TOTAL 1"
Range("A" & xlA + 1) = "TOTAL 2"
DerCol = Range("b2").End(xlToRight).Column
DerLig = Range("a3").End(xlDown).Row
For i = 3 To DerLig - 2
Worksheets("listephotos").Cells(i, DerCol).FormulaLocal = "=NBVAL(B" & i & ":J" & i & ")" 'c'est le J qui est variable
Next
For i = 2 To DerCol - 1
Worksheets("listephotos").Cells(DerLig - 1, i).FormulaLocal = "=NBVAL(L3C" & i & ":L" & DerLig - 2 & "C" & i & ")"
Next
For i = 3 To DerCol - 1
Worksheets("listephotos").Cells(DerLig, i).FormulaLocal = "=L" & DerLig - 1 & "C2+L" & DerLig - 1 & "C" & i
Next
Range("B1", Cells(1, DerCol - 1)).Select
Selection.Merge
End Sub