返回列表 上一主題 發帖

[發問] 如何只讀取到篩選到的數量及金額

雖然解法不太一樣,但嚐試一下

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

End Sub

TOP

回復 3# av8d


感謝提供新的方式,我的方式恐怕會讓整體速度變慢,您的作法好很多
謝謝

TOP

        靜思自在 : 靜坐常恩己過、閒談莫論人非。
返回列表 上一主題