macro to change column to keep only last 5 characters

S

S Himmelrich

I'm not sure how I can use left or right or trim on this, but any
suggestions?
 
G

Gord Dibben

Formula method.

Assuming data in column A, in B1 enter =RIGHT(A1,5) and double-click fill
handle to copy down.

Macro method. You choose the activecell.

Sub trimmit()
Dim rng As Range
Set rng = Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp))
For Each cell In rng
cell.Value = Right(cell.Value, 5)
Next
End Sub


Gord Dibben MS Excel MVP
 
Top