ss2012
08-21-2019, 11:44 PM
How to count characters in cell and then highlight.
Option Explicit
Sub test()
Dim r As Range
Dim s As String
Dim k As Long
Dim n As Long
Set r = ActiveCell
r.Font.Color = vbBlack
s = r.Value
For k = 1 To Len(s)
If Mid(s, k, 1) Like "[!0-9]" Then
n = n + 1
r.Characters(k, 1).Font.Color = vbRed
End If
Next
MsgBox n
End Sub
マナ
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.