Selective hardcoding with VBA / Copy - paste cell value if match text string RRS feed

  • Question

  • Hi all,

    First time posting for me and hoping to get some help with VBA for selective hardcoding.

    I currently have a column into which a formula is set which returns either blank or a variety of text strings (the status of our company's orders). 

    I need to make a macro that looks into all the cells of that column and copy/pastes as value into that same cell only if the formula in that cell returns text string "Received". It should not affect the other cells where the formula is returning either blank or a different text string. 

    Would really appreciate your help. Please let me know if you need more info. 

    Thanks in advance,

    Friday, January 3, 2014 12:43 AM

All replies

  • Try this:

    Sub ReplaceReceived()
        Dim cel As Range
        Application.ScreenUpdating = False
        For Each cel In Range("A1:A10") ' or Selection
            If cel.Value = "Received" Then
                cel.Value = cel.Value
            End If
        Next cel
        Application.ScreenUpdating = True
    End Sub

    Change Range("A1:A10") to the range in which you want to replace. If you prefer to select the range before running the macro, change Range("A1:A10") to Selection.

    Regards, Hans Vogelaar (

    Friday, January 3, 2014 10:39 AM