I have the following macro code set up
Sub Convert()
Dim EndRow As Long
'Find last row based on column D
EndRow = Sheet1.Range("D" & Rows.Count).End(xlUp).Row
'Formulas for each column
Sheet2.Range("F3:F" & EndRow).Formula = "='Scripts'!E3"
Sheet2.Range("E3:E" & EndRow).Formula = "='Scripts'!D3"
Sheet2.Range("D3:D" & EndRow).Formula = "='Scripts'!C3"
Sheet2.Range("C3:C" & EndRow).Formula = "='Scripts'!B3"
Sheet2.Range("B3:B" & EndRow).Formula = "=VLOOKUP(A3,Table1,4,FALSE)"
Sheet2.Range("A3:A" & EndRow).Formula = "='Scripts'!A3"
Sheet2.Range("G3:G" & EndRow).Formula = "='Scripts'!F3"
End Sub
Sheet 1 is called Scripts FYI
For a few of the formulas I want to implement an IF statement, but I get an error.
For example, for range B3:B, I want the formula
=IF('Scripts'!A3<>"", VLOOKUP(A3,Table1,4,FALSE), "")
Is there a correct way of including IF statements into the code without causing errors? Or is there a more efficient macro which can be implemented that I overlooked?
Thanks for any assistance.
Bookmarks