I have to check whether two cells are equal or not, if they are equal than it should show "True" else "False".
So condition is if cell "BP2"="BP3" than BQ2= "True" Else "False" like this for whole column.
This is what I tried-
If Sheets("A").Range("BP2") = Sheets("A").Range("BP3") Then
Sheets("A").Range("BQ2") = "TRUE"
Else
Sheets("A").Range("BQ2") = "FALSE"
End If
Sheets("A").Range("BQ2").Copy Sheets("A").Range("BQ3:BQ" & LastRow)
I don't know how to apply for whole column. The thing that I know is that this last code line is checking BP2=BP3 for whole BQ column. and I don't know how to resolve this. help me on this
CodePudding user response:
You can do this with the following R1C1 formula:
Sheets("A").Range("BQ2:BQ" & LastRow).FormulaR1C1 = "=(RC[-1]=R[1]C[-1])"
This inserts =(BP2=BP3)
in BQ2, =(BP3=BP4)
in BQ3.. etc.
If you then want to remove the formula to leave the result static:
Sheets("A").Range("BQ2:BQ" & LastRow).Value = Sheets("A").Range("BQ2:BQ" & LastRow).Value