VBA error 1004 Application-defined or object-defined error
Not sure what I'm doing wrong here. I get object defined error on the line "icell.Offset(0, 5).Value = fullpath & colRef & lookrow"
I can print the concatenate results and look at it in a msgbox, but it will not let me inset the value in the "iCell offset."
This is the secton from a larger section of code that is giving me the problem:
Sub test()
Dim icell As Range
Dim fullpath, colRef, lookrow As String
Dim lrow As Long
lrow = Cells(Rows.Count, 2).End(xlUp).Row
For Each icell In Range(Cells(4, 3), Cells(lrow, 3))
lookUp = icell & icell.Offset(0, 2) & icell.Offset(0, 3)
If IsError(Application.WorksheetFunction.VLookup(look Up, refTable, 5, 0)) Then
Else
lookrow = Application.WorksheetFunction.VLookup(lookUp, refTable, 5, 0)
Budg_Add = fullpath & colRef & lookrow
MsgBox Budg_Add
icell.Offset(0, 5).Value = fullpath & colRef & lookrow
End If
Next icell
End Sub
For what it's worth, the end result is a link to a cell in another file.
|