希望能只讀取篩選到的數量及金額
For Each Cell In Selection
s = s + Cells(Cell.Row, "B")
Next Cell
感謝前輩們觀看。作者: catbears 時間: 昨天 09:20
雖然解法不太一樣,但嚐試一下
Private Sub CommandButton1_Click()
Dim Cell As Range, s As Integer
If Range("B2") <> "" Then
Range("B1").Select
suryou = ActiveCell.End(xlDown).Row
s = WorksheetFunction.Subtotal(9, Range("B2", "B" & suryou))
MsgBox s
End If
End Sub
Private Sub CommandButton2_Click()
Dim Cell As Range, s As Integer
If Range("C2") <> "" Then
Range("C1").Select
suryou = ActiveCell.End(xlDown).Row
s = WorksheetFunction.Subtotal(9, Range("C2", "C" & suryou))
MsgBox s
End If