I have the following Formula in Col D (starts in D2) on sheets Fassets -This formula generates the correct result
I need ny VBA code amended o generate this formula in D2 , to start from Codes!$AC$2 up to last row in Col AC and also from Codes!$AB$2 up to last row in Col AB
The formula must then be copied from D2 on sheets Fassets up to the last row where there is data in Col E on sheets Fassets
Howver when running the Macro it generates this formula containing the @ symbol within the formula which is incorrect
Kindly amend my Code accordingly
Code:
=IFERROR(INDEX(Codes!$AC$2:$AC$9,MATCH(TRUE,ISNUMBER(SEARCH(Codes!$AB$2:$AB$9,E2)),0)),"")
I need ny VBA code amended o generate this formula in D2 , to start from Codes!$AC$2 up to last row in Col AC and also from Codes!$AB$2 up to last row in Col AB
The formula must then be copied from D2 on sheets Fassets up to the last row where there is data in Col E on sheets Fassets
Howver when running the Macro it generates this formula containing the @ symbol within the formula which is incorrect
Kindly amend my Code accordingly
Code:
Sub Formula_Description()
Dim LR As Long, LR1 As Long
Dim lastRow As Long
With Sheets("Codes")
lastRow = .Cells(.Rows.Count, "AB").End(xlUp).Row
End With
With Sheets("Fassets")
LR = .Cells(.Rows.Count, "E").End(xlUp).Row
.Range("D2:D" & LR).FormulaR1C1 = _
"=IFERROR(INDEX(Codes!R2C29:R" & lastRow & "C29,MATCH(TRUE,ISNUMBER(SEARCH(Codes!R2C28:R" & lastRow & "C28,RC[1])),0)),"""")"
LR1 = .Cells(.Rows.Count, "E").End(xlUp).Row
.Range("I2:I" & LR1).FormulaR1C1 = "=EOMONTH(NOW(),-2)+1"
End With
Clear_Errors
End Sub
Sub Clear_Errors()
With Sheets("Fassets")
On Error Resume Next
.Range("D:D").SpecialCells(xlCellTypeFormulas, xlErrors).ClearContents
End With
End Sub