設(shè)置窗體相關(guān)屬性 輸入代碼 Private Sub CommandButton1_Click() Dim c As Range Dim c1, n, i As Integer n = 0 For i = 1 To Workbooks.Count For Each c In Sheets(i).UsedRange If c.Value >= 150 And c.Value <= 160 Then c1 = c1 + c.Value n = n + 1 End If ‘更多條件…… Next Next TextBox1.Text = n TextBox2.Text = c1 End Sub 按 F5 運(yùn)行 運(yùn)行效果 注意: 設(shè)置宏安全性,否則可能無法運(yùn)行 工具——宏——安全性 |
|