标签:style blog http ar for sp 数据 div on
今天是2014-11-01 是周末,忙了一周了,终于可以闲下来了,想起最近工作用到的VBA的一个场景,结合VBA的数组,所以就想试试看,结果还好,出来了,这年头,又玩起了VB了,经过多时才接受了VB的种语法风格,闲话不说,进入正题
Sub count_test()
Dim i As Integer
Dim arrs() As Variant
i = 1
irow = UsedRange.Rows.Count
icolumn = UsedRange.Columns.Count
ReDim Preserve arrs(1 To irow, icolumn - 1)
For j = 1 To irow Step 1
strname = Cells(j, 1)
isfind = False
k = 0
For k = 1 To irow
If arrs(k, 0) = strname Then
isfind = True
Exit For
End If
Next k
If isfind Then
arrs(k, 1) = arrs(k, 1) + Cells(j, 2)
Else
arrs(i, 0) = Cells(j, 1)
arrs(i, 1) = Cells(j, 2)
i = i + 1
End If
Next j
For k = 1 To irow
If arrs(k, 0) <> "" Then
Cells(k, 4) = arrs(k, 0)
Cells(k, 5) = arrs(k, 1)
End If
Next k
End Sub
标签:style blog http ar for sp 数据 div on
原文地址:http://blog.csdn.net/tqtihihc/article/details/40678043