| 12
 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
 
 | Sub Assign_Budget()
Dim Data_1 As Worksheet
Dim Input_Data As Range
Dim Data_Month As Range
Dim Tableau_TCC2() As String
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim x As Integer
Dim y As Integer
Set Data_1 = ThisWorkbook.Sheets("Data_1")
Set Input_Data = Data_1.Range("D4")
Set Data_Month = Data_1.Range("L3")
Dim NbCol1 As Integer
Dim NbCol2 As Integer
Dim NbLig As Integer
 
With Data_1
NbLig = .Cells(.Rows.Count, 1).End(xlUp).Row
NbCol1 = .Cells(1, .Columns.Count).End(xlToLeft).Column - 11
End With
 
x = NbLig
y = NbCol1
 
ReDim Tableau_TCC2(1 To x, 1 To y)
 
For i = 1 To x
    For j = 1 To y
        If Data_Month.Offset(0, j - 1) >= Input_Data.Offset(i - 1, 0) And Data_Month.Offset(0, j - 1) < Input_Data.Offset(i - 1, 1) And Data_Month.Offset(-1, j - 1) <> "1" Then
            Tableau_TCC2(i, j) = Input_Data.Offset(i - 1, 6)
        Else
            Tableau_TCC2(i, j) = "0"
        End If
    Next j
Next i
 
 For i = 1 To x
        For j = 1 To y
            Data_Month.Offset(i, j - 1) = Tableau_TCC2(i, j)
        Next j
    Next i
 
End Sub | 
Partager