小弟剛接觸VBA,想要請問怎麼利用for迴圈 怎麼用IF篩選B列是否是數字,還有表格內有很多空格,要怎麼跳過空格去計算有數字的格數有多少?
試試看這樣呢?
Sub test()
Dim i As Integer
Dim count As Integer
count = 0
For i = 1 To Range("B65536").End(xlUp).Row
If IsNumeric(Range("B" & i)) And Range("B" & i) <> "" Then
count = count + 1
End If
Next
MsgBox ("數字格數: " & count)
End Sub