Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49892

Find & Replace

$
0
0
Hi, Please have look on code. I need to do small task. From A2, replace all “1”s with “PMAH” and all others with “NON- PMAH”. Column has header that’s why I taken from A2. I am able to do with “1” replace to “PMAH” but mind is not working regarding “NON-PMAH”. Plz advise.

Code:

Sub FindReplace()

Dim a As Range

With ActiveSheet

For Each a In .Range(.Range("A2"), .Range("A2").End(xlDown))

a = Replace(a, "1", "PMAH")
Next
End With

End Sub

Viewing all articles
Browse latest Browse all 49892

Trending Articles