Chefsohail
Board Regular
 Joined
 Oct 3, 2020
 Messages
 59
 Office Version

 365
 Platform

 Windows
Hi Team,
I am a rookie in VBA and am learning.
I am currently using a formula in Cell and it returns the desired value. However when i use the same formula in VBA it doesnt work.
I managed to find a thread on similar lines and for now have used their code and added the formula.
Can someone please help fix this.
Sub Test()
Application.ScreenUpdating = False
Dim c As Range
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "Q").End(xlUp).Row
For Each c In Range("Q2:Q" & Lastrow)
c.formula = IFERROR(IF((VLOOKUP(P2,'Data_Logic '!B:B,1,0))=(VLOOKUP(P2,'Data_Logic '!B:B,1,0)),"No",""),""))
Next
Application.ScreenUpdating = True
End Sub
Error Message: Compiled Error : Expected Expression
I am a rookie in VBA and am learning.
I am currently using a formula in Cell and it returns the desired value. However when i use the same formula in VBA it doesnt work.
I managed to find a thread on similar lines and for now have used their code and added the formula.
Can someone please help fix this.
Sub Test()
Application.ScreenUpdating = False
Dim c As Range
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "Q").End(xlUp).Row
For Each c In Range("Q2:Q" & Lastrow)
c.formula = IFERROR(IF((VLOOKUP(P2,'Data_Logic '!B:B,1,0))=(VLOOKUP(P2,'Data_Logic '!B:B,1,0)),"No",""),""))
Next
Application.ScreenUpdating = True
End Sub
Error Message: Compiled Error : Expected Expression