Hi Vientotambo,
There's probably an easier way but:
Sub ChangeForm()
Dim F, S As String, I As Integer, J As Integer
F = ActiveCell.Formula: S = CStr(F)
For I = Len(S) To Len(S) - 5 Step -1
If Not IsNumeric(Mid(S, I, 1)) Then
Exit For: End If: Next I
J = Val(Right(S, Len(S) - I)): J = J + 1
S = Left(S, I) & J
ActiveCell = S: End Sub
Copy the code to the clipboard
Press ALT + F11 to open the Visual Basic Editor.
Select Module from the Insert menu
Type "Option Explicit" then paste the code into the white space under it.
Press ALT + Q to close the code window.
with the cell you want to change selected
Press ALT + F8 then double click on ChangeForm
If you want to run the whole column:
Sub ChangeForm()
Dim F, S As String, I As Integer, J As Integer
If ActiveCell = "" Then Exit Sub
F = ActiveCell.Formula: S = CStr(F)
For I = Len(S) To Len(S) - 5 Step -1
If Not IsNumeric(Mid(S, I, 1)) Then
Exit For: End If: Next I
J = Val(Right(S, Len(S) - I)): J = J + 1
S = Left(S, I) & J
ActiveCell = S
ActiveCell.Offset(1, 0).Select
ChangeForm
End Sub
Bookmarks