-2
Sub arraystring()
Dim strname() As String, count As Integer
Dim element As Variant
count = 0
strname = ("sathesh")
For Each element In strname
count = count + 1
Next
MsgBox "The total Count is" & count
End Sub
有人可以幫助我在上面的代碼。我需要獲得數組字符串中分配的字符串的計數。數組字符串的vba宏
您爲strname分配了一個字符串「sathesh」,但strname被聲明爲字符串數組。這應該首先得到糾正。在將字符串分配給strname之前,您永遠無法獲得字符串的數量。 – 2014-10-05 02:49:48
你只是在尋找'Len(「string」)' – Matt 2014-10-05 03:23:32