Jason Fenn
Jason Fenn

Reputation: 17

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

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".

Upvotes: 0

Views: 99

Answers (1)

Basbadger
Basbadger

Reputation: 234

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

Upvotes: 1

Related Questions