|

楼主 |
发表于 2014-12-24 10:44
|
显示全部楼层
Sub test()
Set Rng = Range("A3").CurrentRegion '?中A3后自??展?元格?域? A1:AA202
arr = Rng
For i = 1 To UBound(arr) '遍?各行
For j = 1 To UBound(arr, 2) '遍?各列
If IsEmpty(arr(i, j)) Then
cnt1 = cnt1 + 1 '?查???Empty空白?元格?量
ElseIf arr(i, j) = "" Then
cnt2 = cnt2 + 1 '?查??零?度字符的空?元格?量
arr(i, j) = Empty '?理?Empty空白?元格
Else
cnt3 = cnt3 + 1 '???度不?零的其它?元格?量
End If
Next
Next
MsgBox Rng.Address(0, 0) & vbLf & Rng.Count & vbLf & cnt1 & vbLf & cnt2 & vbLf & cnt3
Rng.Value = arr '更新??理后的?据
End Sub
曾經有個大神給我我上面的段代碼,在剛從數據庫導出時有用
但我加了公式,變了一下格式就不能用了,求類似以上的代碼改良可以避開公式,查所有儲存格就最好
但是小弟不會VBA啊,
求 |
|