Hi all, I am little stuck with below. I run my macro to check if column 8 matches column 10.
My result is returned in column M - I only want the result to be returned if a cell is blank.. my formula screws up if I have 5 filled cells and on next blank cell in row 6, my formula returns result but it uses my numbers from row 2. ofcourse I need my result to be returnded on data from row 6(not initial row2)
Sub Test()
Dim LastRow2 As Long
Dim rng As Range
LastRow2 = Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
Set rng = Nothing
On Error Resume Next
Set rng = .Range("M2:M" & LastRow2).SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If Not rng Is Nothing Then rng.FormulaR1C1 = _
"=IF(R2C10=R2C8,""Matches"","""")"
Set rng = .Range("M2:M" & LastRow2)
rng.Value = rng.Value
End With
End Sub
Bookmarks