Private Sub Command1_Click()
Dim a(25) As Integer
s = Text1
For i = 1 To Len(s)
c = Mid(s, i, 1)
If c >= "a" And c <= "z" Then c = Chr(Asc(c) - 32)
If c >= "A" And c <= "Z" Then
j = Asc(c) - 65
a(j) = a(j) + 1
End If
Next i
j = 0
For i = 0 To 25
If a(i) > 0 Then
j = j + 1
Text2 = Text2 & Chr(65 + i) & "=" & a(i) & " "
If j Mod 8 = 0 Then Text2 = Text2 & vbCrLf
End If
Next i
End Sub
Private Sub Form_Load()
Text1 = ""
Text2 = ""
End Sub
用公式SUMPRODUCT试试看可以不
Private Sub Form_Click()
Dim a(65 To 90)
s = UCase(Text1.Text)
For i = 1 To Len(s)
n = Asc(Mid(s, i, 1))
If n >= 65 And n <= 90 Then
a(n) = a(n) + 1
End If
Next i
For i = 65 To 90
Picture1.Print "字符"; Chr(i) & "的个数" & a(i)
Next i
End Sub