View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ryan H Ryan H is offline
external usenet poster
 
Posts: 489
Default Macro to update last character

Hope this helps! If so, let me know, click "YES" below.

Sub ReplaceLastCharacter()

Dim LastRow As Long
Dim MyRange As Range
Dim cell As Range

LastRow = Cells(Rows.Count, "G").End(xlUp).Row
Set MyRange = Range("G1:G" & LastRow)
For Each cell In MyRange
cell.Value = Left(cell.Value, Len(cell.Value) - 1) & "2"
Next cell

End Sub
--
Cheers,
Ryan


"maryj" wrote:

We are using Excel 2007. We will have a list of id numbers that we need the
last number to update from a 1 to a 2. The length of the list will vary each
time but the values will always be in column G.
For example:

11323674US01
11321507US01
11378181US01

Need to be updated to:

11323674US02
11321507US02
11378181US02

Thanks for your help!

--
maryj