Results 1 to 5 of 5

Drag down mismatch, pull wrong cell (need $ in my cell?)

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-31-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    204

    Drag down mismatch, pull wrong cell (need $ in my cell?)

    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
    Last edited by donyc; 02-21-2012 at 11:14 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1