Jin's Joke Made for Excel VBA

익명 사용자의 이미지

VBA for Excel...
실무를 위해... VBA를 강요당하고 있습니다..흑.
그리우십니까?
(懐かしいですか。)

Option Explicit

Sub jin_score()
    'If Not IsErr(ActiveCell.Value) Then
        ActiveCell.Offset(0, 1).Value = JinScore(ActiveCell.Value)
    'End If
End Sub

Private Function JinScore(s As String) As Integer
    Dim cnt As Integer
    cnt = 0
    
    Dim ch As Integer
    Dim i As Integer
    For i = 1 To Len(s)
        ch = AscW(LCase(Mid(s, i, 1))) - AscW("a") + 1
        
        If ch >= 1 And ch <= 26 Then
            cnt = cnt + ch
        End If
    Next i
    
    JinScore = cnt
End Function
Forums: 
익명 사용자의 이미지