.
The following macro (CollectProjectItems) functions as designed. Applying the same logic, with a change in the Range, in the macro (CollectContractorItems) does not function as desired.
I am presuming the error is something I've overlooked and of course ... for the life of me ... I cannot identify my error.
Need a fresh set of eyes.
Thank you ahead of time.
Sub UpdateCharts()
CollectProjectItems
CollectContractorItems
End Sub
Sub CollectProjectItems()
On Error Resume Next
MyDate = Format(Date, "mmm") & "-" & Right(Year(Date), 2)
For Each cl In Range("A3", Range("A" & Rows.Count).End(xlUp))
wproj = Application.Match(cl.Value, Columns(10), 0)
If IsNumeric(wproj) Then
MyMonth = Application.Match(MyDate, Rows(wproj + 1), 0)
Cells(wproj + 2, MyMonth) = cl.Offset(, 1)
Cells(wproj + 3, MyMonth) = cl.Offset(, 2)
End If
Next
End Sub
Sub CollectContractorItems()
On Error Resume Next
MyDate = Format(Date, "mmm") & "-" & Right(Year(Date), 2)
For Each cl In Range("E3", Range("E" & Rows.Count).End(xlUp))
wproj = Application.Match(cl.Value, Columns(25), 0)
If IsNumeric(wproj) Then
MyMonth = Application.Match(MyDate, Rows(wproj + 1), 0)
Cells(wproj + 2, MyMonth) = cl.Offset(, 1)
Cells(wproj + 3, MyMonth) = cl.Offset(, 2)
End If
Next
End Sub
The second macro does not complete the required edits in Col AG. It duplicates the same edit as the first macro for Col R.
I don't understand how to change the second macro so it affects edits in Cols Z:AK .
???
Download example workbook : Macro Error