Home > Mobile >  Excel change a cell text based on it's original value and another cells value
Excel change a cell text based on it's original value and another cells value

Time:05-22

I've tried myself and have been failing miserably over the last couple days to accomplish.

Need a Macro to check Column A full range, for a specific value "ZP" and if true, then check column C in those rows and if that value starts with a "Z" then change column A cell in that row to "ZPAC".

CodePudding user response:

This will get it done

Sub ZPtoZPAC()
    For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
        If Cells(i, "A").Value = "ZP" Then
            If Left(Cells(i, "C").Value, 1) = "Z" Then
                Cells(i, "A").Value = "ZPAC"
            End If
        End If
    Next i
End Sub
  • Related