0
我正在通過添加字符的ASCII來處理數據屏蔽工具,但是一旦達到最大ASCII數字,它就會發生錯誤。通過更改字符屏蔽Excel宏數據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
您好,感謝的一段代碼。然而,當運行一串字符的代碼時會出現新的故障。它會在每次運行宏時複製單元格值。 例子 Å>÷÷÷÷÷÷÷÷ – Silverchain
這很奇怪,我看不出它是如何添加比原始字符串更多的字符的。我將把我的整個代碼放在一個調試語句的答案中去嘗試。 –
它現在完美運作。謝謝! – Silverchain