Bonjour tout le monde!

J'ai une petite colle en VBA, en effet je dispose d'un progamme VBA qui récupère certaine valeur dans un tableau de la manière suivante:

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
Sub recherche_hosting()
 
Dim Sub_total_hosting As Integer
Dim i_rack As Variant
Dim j_rack As Variant
Dim x As Range
Dim total_rack As Variant
 
'MsgBox i_rack
'MsgBox j_rack
'MsgBox total_rack
 
Set x = Cells.Find("Hosting", , xlValues, xlPart, , , False)
If Not x Is Nothing Then x.Offset(3, 13).Select
i_rack = ActiveCell.Value
MsgBox i_rack
 
Set x = Cells.Find("Hosting", , xlValues, xlPart, , , False)
If Not x Is Nothing Then x.Offset(4, 13).Select
j_rack = ActiveCell.Value
MsgBox j_rack
 
total_rack = i_rack + j_rack
MsgBox total_rack
 
Set x = Cells.Find("Hosting", , xlValues, xlPart, , , False)
If Not x Is Nothing Then x.Offset(3, 16).Select
If ActiveCell.Value = "" Then
    Set x = Cells.Find("Hosting", , xlValues, xlPart, , , False)
    If Not x Is Nothing Then x.Offset(3, 15).Select
End If
 
 
Sub_total_hosting = ActiveCell.Value
MsgBox Sub_total_hosting
 
End Sub
Je souhaite rentrer dans le tableau suivant (qui m'a l'air pas très bien créer...) le nom hosting dans la colonne "Article", et les valeurs total_racks dans la colonne "Description" et la valeurs Sub_total_hosting dans la colonne "Quantité".Le problème est que je fais avoir plein de valeur de ce type et je voudrais donc que le tableau se remplisse ligne par ligne au fur et a mesure que je récupère les différentes valeur!

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
Sub julien()
 
 
On Error GoTo FaireErreur
 
Dim myYear As Variant
Dim myMonth As Variant
Dim myDate As Variant
 
 
myMonth = DatePart("m", Date)
myYear = DatePart("yyyy", Date)
myDate = myYear * 100 + myMonth
'myDate = myYear + myMonth
'MsgBox myDate
'MsgBox myMonth
 
 
Columns(1).Value = "FH57"
Columns(2).Value = "FRA"
Columns(16).Value = "X"
Columns(12).Value = "EUR"
Columns(3).Value = myDate
 
Range("A1").Value = "Organisation commerciale"
Range("B1").Value = "Agence Commercial"
Range("C1").Value = "Mois"
Range("D1").Value = "Donneur d'ordre"
Range("E1").Value = "Code affaire"
Range("F1").Value = "Article"
Range("G1").Value = "Description"
Range("H1").Value = "Description supplémentaire"
Range("I1").Value = "Date de début"
Range("J1").Value = "Date de fin"
Range("K1").Value = "Quantité"
Range("L1").Value = "Devise"
Range("M1").Value = "SIF Optionel"
Range("N1").Value = "SI_SATIP"
Range("O1").Value = "Localisation"
 
Sheets("NomDeLaFeuille").Select
 
Range("A2").Select
 
'For Each BarreCommande In CommandBars
 
'ActiveCell.FormulaR1C1 = BarreCommande.Application
 
'ActiveCell.Offset(0, 1).Range("A1").Select
 
'Next
 
Exit Sub
 
FaireErreur:
 
MsgBox "ERREUR"
 
Resume Next
End Sub


Je tiens à préciser que je suis un simple débutant, donc il est possible que mon code ne sois pas optimal, si vous avez donc des critiques ou des suggestion je suis tout OUÏE !

En vous remerciant tous par avance !

Julien