Bonjour, je suis nouvelle sur ce forum. Je débute en VBA. Je me suis lancée dans la construction d'un budget perso et je voudrai un code qui me mette en place mes 12 tableaux correspondant aux 12 mois de l'année.
Je dois donc faire une boucle (mais je n'en suis pas encore là). Je bloque sur une formule

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Sub CT()
' CT Macro
'
' Touche de raccourci du clavier: Ctrl+t
    Dim CelMois As Integer
    Dim List As String
    Dim NomTab As String
    
    List = "Listing"
    Range("A86").Select
    CelMois = Range("A86")
    Debug.Print CelMois
    NomTab = List & CelMois
    Debug.Print NomTab

    Range("A87").Select
    ActiveCell.FormulaR1C1 = "Date"
    Range("B87").Select
    ActiveCell.FormulaR1C1 = "Libellé"
    Range("C87").Select
    ActiveCell.FormulaR1C1 = "Montant"
    Range("D87").Select
    ActiveCell.FormulaR1C1 = "Solde"
    Range("E87").Select
    ActiveCell.FormulaR1C1 = "P"
    Range("A87:E99").Select
    ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$87:$E$100"), , xlYes).Name = _
        NomTab
    Range("Listing1[#All]").Select
    ActiveSheet.ListObjects("Listing1").TableStyle = "TableStyleDark6"
    Range(NomTab).Select
    Range("A100").Activate
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Sheets("Paramètres").Select
    Range("Prélèvement[[Libellé]:[Montant]]").Select
    Selection.Copy
    Sheets("BMP").Select
    Range("B89").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("D100").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "0"
    Range("D99").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "=R[1]C+[@Montant]"
    Range("D99").Select
    Selection.AutoFill Destination:=Range("D88:D99"), Type:=xlFillDefault
    Range("D88").Select
    ActiveCell.Offset(-1, 4).Select
    
    
End Sub
La variable NomTab contient bien la concaténation de "Listing" et de la cellule A86 qui me donne le N° du mois. J'ai essayé de rentrer NomTab dans la formule (en bleu) mais je me fais injurier à chaque tentative de modif.
Pour pouvoir fonctionner, la boucle que je veux créer doit utiliser cette variable. Et je n'arrive pas à l'insérer. En fait dans Range("Listing1[#All]").Select, Listing1 doit être remplacé par NomTab qui lui doit varier jusqu'à 12. That's my big problem.

Merci pour une petite aide