我正在通过添加字符的 ASCII 来开发数据屏蔽工具,但是一旦达到最大 ASCII 数就会出错。
如果 ASCII 数字已经达到最大 ASCII 数字,有什么方法可以阻止或忽略它的添加?
我的excel代码
Sub DataMask()
Dim rngCell As Range
Dim intChar As Integer
Dim strCheckString As String
Dim strCheckChar As String
Dim intCheckChar As Integer
Dim strClean As String
For Each rngCell In Selection
strCheckString = rngCell.Value
strClean = ""
intChar = 1
If strCheckString <> "" Then
For intChar = 1 To Len(strCheckString)
strCheckChar = Mid(strCheckString, intChar, 1)
intCheckChar = Asc(strCheckChar) + 68
strClean = strClean & Chr(intCheckChar)
Next intChar
rngCell.Value = strClean
End If
Next rngCell
End Sub