jmthompson
Well-known Member
- Joined
- Mar 31, 2008
- Messages
- 966
Code:
Sub DropShip()
MyDate = DateSerial(Year(Date), Month(Date) - 1, 1)
MyMonth = Format(MyDate, "mmmm")
MyYear = Year(MyDate)
MyPath = "C:\Documents and Settings\JThomps2\Desktop\WorkflowOne\Billing\" & MyYear & "\" & MyMonth & "\Drop Ship\"
MyFile = MyMonth & " " & MyYear & ".xls"
MyPDFile = "TPD " & MyMonth & " " & MyYear & ".xls"
Sheets(MyMonth & " " & MyYear).Select
Dim c As Range
For Each c In Range([B50], Cells(Rows.Count, "B").End(xlUp))
If c = "12100 - The Grand Rapids Press" Then c.Offset(0, 4).FormulaR1C1 = "=VLookup(c.Offset(0, 1), [MyPath & MyFile]Grand Rapids!(B5:D23), 3, False)"
Next c
End Sub
Run-Time error 1004 Application defined or object defined error
This is highlighted
Code:
c.Offset(0, 4).FormulaR1C1 = "=VLookup(c.Offset(0, 1), [MyPath & MyFile]Grand Rapids!(B5:D23), 3, False)"
I am fairly certain it is the table array reference that isn't done correctly, but my attempts to fix it haven't worked.