Hi Guys,
I wonder if someone could take the time to help..
I would like to amend this code slightly by forcing it to perform the exact same function on an additional tab called Forecast.
So where the code says With Worksheets("Drill Down") I want it to say With Worksheets("Drill Down") and worksheet Forecast, however I am not having much success!
Maybe it's something like
Worksheets("Drill Down").select
WorkSheets("Forecast").select
Thanks for looking
Option Explicit
Sub dRILLDOWN()
Dim x, i As Long, y, ii&, j&, k&
Application.ScreenUpdating = 0
With Worksheets("Drill Down")
y = .Range("F8:S" & .Cells.Find("*", , , , xlByRows, xlPrevious).Row)
End With
With Worksheets("Source Data")
x = .Range("A1:B" & .Cells.Find("*", , , , xlByRows, xlPrevious).Row)
End With
With Worksheets("Drill Down")
For i = 2 To UBound(y, 1)
For j = 1 To UBound(x)
If y(i, 2) = "Actual" Then
If y(i, 1) = x(j, 1) Then
For ii = j + 1 To UBound(x)
k = 7
Do Until x(ii, 1) = "TOTAL"
k = k + 1
.Cells(i + 7, k) = x(ii, 2)
ii = ii + 1
Loop
Exit For
Next
End If
End If
Next
Next
End With
Application.ScreenUpdating = True
End Sub
Bookmarks