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
|
Sub MacTest(SCOPE As Variant)
Dim NL, r, j, k As Integer
Dim CurrentWb As Excel.Workbook
Set CurrentWb = ThisWorkbook
Set SheetRCP = CurrentWb.Worksheets("RECAP")
Set SheetTCD = CurrentWb.Worksheets("TCD_" & SCOPE)
For r = 1 To Worksheets.Count
If (Worksheets(r).Name = "TCD_" & SCOPE) Then
For i = 2 To LastrCP
If InStr(1, SheetTCD.Cells(6, 1), SheetRCP.Cells(i, 5), SCOPE) > 0 Then
For k = 2 To LastcTC
NL = SheetRCP.Cells(i, 5).Row
If (Trim(SheetTCD.Cells(5, k).Value) = Trim(SheetRCP.Cells(i - NL, k + 4).Value)) Then
SheetRCP.Activate
Activatesheet.Cells(i, k + 4).Select
ActiveCell.FormulaR1C1 = "=GETPIVOTDATA("" & SCOPE & "",'[ & ""TCD_"" & SCOPE & ]'!R4C1,""DT_ARRI"",Trim(Activatesheet.Cells(i - NL, k + 4).Value))"
End If
Next k
End If
Next i
End If
Next r
End Sub |
Partager