这是你正在尝试的吗?逻辑是获取ASC
数字并将其加一(条件适用)
Sub sample()
Dim sCheck As String
'~~> Uncomment any of the below to test
'sCheck = "AZ"
'sCheck = "B9"
'sCheck = "ZZ"
'sCheck = "C9"
Debug.Print GetNext(sCheck)
End Sub
Function GetNext(s As String) As String
If s = "" Then Exit Function
Dim s1 As String, s2 As String
s1 = Left(s, 1)
s2 = Right(s, 1)
Select Case UCase(s2)
Case "Z"
If s1 = "Z" Then
GetNext = "You have reached the end of the sequence"
Exit Function
End If
s1 = Chr(Asc(s1) + 1)
s2 = "0"
Case "9"
s2 = "A"
Case Else
s2 = Chr(Asc(s2) + 1)
End Select
GetNext = s1 & s2
End Function