I'm building a project tracker, with a high level overview on the first sheet, and then for each Project an associated sheet that contains a details. (i.e. Project 1, Project 2, Project 3 show as rows in the first sheet, and then Project 1 has it's own sheet, Project 2 has it's own sheet, etc.)
I am trying to automate updates to this tracker. Each time a row is added to the high level tracker, I want to copy specific non-contiguous cells and paste the values in the associated sheet.
My first attempt was to complete this task for the first project in the tracker. There are no errors but there are no outputs into the specified destination.
Some other things to note:
- For high level tracking file, Project 1 goes from cells A9:A10, Project 2 goes from cells A13:A18, and so on. They are one on top of the other
- An issue in my code is that I call out specific cells to create an array. I would imagine that for the next project I would have to manually adjust these call outs. Any advice to circumvent that?
Sub Update_Project_1()
Dim LR As Long, i As Long, cls
Dim wscopy As Worksheet
Dim wspaste As Worksheet
Set wscopy = Workbooks("Project_Tracker.xlsm").Worksheets("High Level Tracker")
Set wspaste = Workbooks("Project_Tracker.xlsm").Worksheets(" Project 1 Detailed Tracker")
With wscopy
cls = Array("A10", "B10", "C10", "F10", "H10")
End With
With wspaste
LR = WorksheetFunction.Max(4, .Range("A" & Rows.Count).End(xlUp).Row + 1)
Debug.Print LR
For i = LBound(cls) To UBound(cls)
.Cells(LR, i + 1).Value = wspaste.Range(cls(i)).Value
Next i
End With
End Sub