I have excel formulas that i have tested and got to work in the spreadsheet, I have typed a code which does most of all the same thing but i have encountered a problem with syntax. The issue seems to be that I cant get vba to recognize my if statement conditions (text). The excel formula should mirror the vba formula for the line commented match.
Excell:
=IF(E2&F2=B2&C2,"Y","N")
VBA:
'Insert Match Formulas
Dim lLR As Long
' Dim Y As Integer
' Dim N As Integer
lLR = Range("C2").End(xlDown).Row 'DEFINES RANGE LENGTH
'Enter Formulas
Range("W2:W" & lLR).FormulaR1C1 = "=ROUNDUP(MONTH(R[0]C[-1])/3,0)" 'TERM DATE QUARTER R2C3
Range("X2:X" & lLR).FormulaR1C1 = "=YEAR(R[0]C[-2])" 'TERM DATE YEAR
Range("AA2:AA" & lLR).FormulaR1C1 = "=ROUNDUP(MONTH(R[0]C[-1])/3,0)" 'PAYROLL QUARTER
Range("AB2:AB" & lLR).FormulaR1C1 = "=YEAR(R[0]C[-2])" 'PAYROL YEAR
Range("AC2:AC" & lLR).FormulaR1C1 = "=IF(R[0]C[-6]&R[0]C[-5]=R[0]C[-2]&R[0]C[-1],Y,N)" 'MATCH
Range("AF2:AF" & lLR).FormulaR1C1 = "=IF(R[2]C[29]=Y,0,R[2]C[31])" 'CONTRIBUTION QUARTER MATCH
Bookmarks