Reputation: 377
Below code is giving error (1004)
Sheets(2).Cells(i, 7).Formula = "=LEFT(" & Sheets(2).Cells(i, 5) & ",2)"
Upvotes: 0
Views: 42
Reputation: 1192
You are passing the value of a cell to LEFT
, which expects either a cell reference or a string (including the quotation marks). Try
Sheets(2).Cells(i, 7).Formula = "=LEFT(" & Sheets(2).Cells(i, 5).Address & ",2)"
or
Sheets(2).Cells(i, 7).Formula = "=LEFT(""" & Sheets(2).Cells(i, 5) & """,2)"
instead.
Upvotes: 2