Macro to remove last 4 characters from the contents of a cell.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We need to come up with a way to remove the last 4 characters from the
contents of a cell. I tried a macro, but wasn't sure how to make it go to
the next cell. For example, I select a cell, press end, backspace 4
positions and then hit enter. Works great for 1 cell! Is there a way to get
the macro to repeat all the way down the spreadsheet?

As always, Thanks for the help!

Ken
 
Ken,

Select the cells and run this macro:

Sub Remove4()
Dim myCell As Range
For Each myCell In Selection
myCell.Value = Left(myCell.Value, Len(myCell.Value) - 4)
Next myCell
End Sub

HTH,
Bernie
MS Excel MVP
 
Back
Top