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

VBA code - Convert one value to another value

$
0
0
Dear all,


I have the following values in column B:
CITG
WF
JPM

I would like to translate the codes into meaning names in column C such as:
(desired output)
CITG --> Citi
W F--> fargo
JPM --> jp.morgan

I am using the following code below, however the code below is not printing anything in the next column.

Code:

Sub Convert_Name()
Dim Rng As Range, Dn As Range
Set Rng = Range(Range("B2"), Range("B" & Rows.Count).End(xlUp))
Columns("C:C").ClearContents
For Each Dn In Rng
    Select Case UCase(Left(Dn, 1))
        Case "CITG": Dn.Offset(, 1) = "citi bank"
        Case "JPM": Dn.Offset(, 1) = "J.P.Morgan"
    End Select
Next Dn
End Sub

Any help would be very much appreciated.

Thank you for your time and help.

Viewing all articles
Browse latest Browse all 50079

Trending Articles