macro to change column to keep only last 5 characters

  • Thread starter Thread starter S Himmelrich
  • Start date Start date
S

S Himmelrich

I'm not sure how I can use left or right or trim on this, but any
suggestions?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top