看了一下你的追问截图,其实不用这么麻烦,直把ASC相加写成一个自定义函数,然后在EXCEL中像调用其他内置函数一样调用,这样A1的值变了,B1也会变,如下图:
Option Explicit
Function test(ByVal rng As Range) As Long
Dim i As Integer
If rng.Count > 1 Then
test = 0: Exit Function
End If
For i = 1 To Len(rng.Value)
test = test + Asc(Mid(rng.Value, i, 1)) - 96
Next i
End Function
用工作表的SelectionChange和Change事件相结合就可以了
写个事件就可以了