One solution is to use Regular Expressions.
Regular Expression
The following expression can be used: \d+(?=$)
Where this expression captures one or more \d+
digits before the end of the string (?=$)
And the demo can be viewed at this link
Enable Regex in Excel
RegEx needs to be enabled, Enable Developer mode
In the 'Developer' tab, click 'Visual Basic' and the VBA window will open.
Go to 'Tools' - > 'References ...' and a window will open.
Look for 'Microsoft VBScript Regular Expressions 5.5', as in the image below. And enable this option.
Code
DimnumeroAsLongDimcodigoAsString,resultadoAsStringDimobjCorrespAsObject,objExpRegAsObjectSetobjExpReg=CreateObject("VBScript.RegExp")
'Expressão Regular
objExpReg.Pattern = "\d+(?=$)"
objExpReg.Global = True
codigo = "T110A17099"
Set objCorresp = objExpReg.Execute(codigo)
If objCorresp.Count <> 0 Then
For Each c In objCorresp
numero = CLng(c) + 1
codigo = Replace(codigo, c, "")
Next c
End If
resultado = codigo & numero
MsgBox (resultado)
Function Code (UDF)
Function funcao_incrementar(codigo As String) As String
Dim numero As Long
Dim objCorresp As Object, objExpReg As Object
Set objExpReg = CreateObject("VBScript.RegExp")
'Expressão Regular
objExpReg.Pattern = "\d+(?=$)"
objExpReg.Global = True
Set objCorresp = objExpReg.Execute(codigo)
If objCorresp.Count <> 0 Then
For Each c In objCorresp
numero = CLng(c) + 1
codigo = Replace(codigo, c, "")
Next c
End If
funcao_incrementar = codigo & numero
End Function
Testing
Sub teste()
MsgBox (funcao_incrementar("T110A17099"))
End Sub