Excel and/if Phone Number Replace Macro

  • Hello,

    I have a datasheet that constantly has information pasted into it. In column D, we store the alternate phone numbers while in column C, it has the default phone numbers.

    I am looking for a simple macro that will copy and paste the information from column C into column D without overwriting existing data in column D.

    Thank you for any help!

  • Re: Excel and/if Phone Number Replace Macro


    1. Sub CDatatoBwhereBisempty()
    2. Dim LastRow As Long
    3. Dim n As Long
    4. LastRow = ActiveSheet.UsedRange.Rows.Count
    5. For n = LastRow To 1 Step -1
    6. ActiveSheet.Range("D" & n).Select
    7. If ActiveCell.Value = "" Then ActiveCell.Value = ActiveCell.Offset(0,-1).Value
    8. Next n
    9. End Sub

    Assuming an empty cell in column C is the Value = "".


  • Re: Excel and/if Phone Number Replace Macro

    Thank you!

    I actually used the code when it was pointed to C, then modified it. Based on your corrections, it looks like I changed it correctly. Thank you so much for your help.