2010年6月22日 星期二

EXCEL 計算 文字的ASCII碼

Sub cal()

'計算 文字的ASCII碼
Application.ScreenUpdating = False
Dim MyRng As Range
Dim x As Range
Dim i As Integer
Dim p As Integer

Dim cnt As Double


Set MyRng = Range("C2:C" & Range("C65535").End(xlUp).Row)

For Each x In MyRng

p = Len(x.Value)

For i = 1 To p
cnt = cnt + Asc(Mid(x.Value, i, 1))

Next
x.Offset(0, 1).Value = cnt
cnt = 0
Next

MsgBox "SUCCESS"

End Sub

沒有留言:

張貼留言

追蹤者