View Single Post
 
Old 03-06-2018, 09:25 AM
ChrisOK ChrisOK is offline Windows 7 64bit Office 2016
Advanced Beginner
 
Join Date: Sep 2016
Posts: 54
ChrisOK is on a distinguished road
Question Reverse Copy Paste - If not blank paste to adjacent cell

I found that the reverse was needed and thought it would be easy to revert using the "<>" and changing the column refcs - but it's not working for some reason? Hoping someone can see what I'm missing?

IF Col I (9) is NOT empty, THEN copy/paste that date that's sitting in I (9) into adjacent Col E (5)


Code:
Sub CopyandPaste()
    Dim LR As Long
    Dim i As Long
    With ActiveSheet
        LR = .Range("I" & Rows.Count).End(xlUp).Row
        For i = 2 To LR
            If Cells(i, 9).Value = "<>" Then Cells(i, 9).Value = Cells(i, 5).Value
        Next i
    End With
    Columns(9).NumberFormat = "mm/dd/yyyy"
End Sub
Reply With Quote