Excel VBA code below will replace the first or last character of the cell value. Use a test workbook with dummy data, to test the VBA code. Works fine on Excel 2010. Sub replaceChar() 'Replace Last Character Dim i, ilength As Integer Dim strCellValue, yCutString, zValue As String Dim iRow, myColumn As Long 'specify the column where the values will be changed myColumn = 2 'get the last row iRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row For i = 1 To iRow On Error Resume Next strCellValue = Cells(i, myColumn).Value ilength = Len(strCellValue) - 1 'left - will replace last character on the string yCutString = Left(strCellValue, ilength) ' LastChar is the string that will be added to the end of the cell value 'Replace this with any desired value zValue = yCutString + "LastChar" 'Display the value of the processed string 'press ctrl+break to stop the loop MsgBox zValue 'uncomment this line to replace the value with ...
Make the world a better place by sharing knowledge, ideas and anything that you can give that comes from the heart.