-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