|
Private Sub 统计_Click()
Dim lastRow As Long
Dim lowerLimit As Double, upperLimit As Double
Dim count As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("人员名册") '假设数据在Sheet1上
'找到G列的最后一行
lastRow = ws.Cells(ws.Rows.count, "F").End(xlUp).row
a = Array(TextBox1, TextBox2, TextBox3, TextBox4, TextBox5, TextBox6)
b = Array(TextBox7, TextBox8, TextBox9, TextBox10, TextBox11, TextBox12)
c = Array(TextBox13, TextBox14, TextBox15, TextBox16, TextBox17, TextBox18)
For i = 0 To 5
AA = Me.Controls(a(i)).Value
BB = Me.Controls(b(i)).Value
CC = Me.Controls(c(i)).Value
count = Application.WorksheetFunction.CountIfs(ws.Range("G4:G" & lastRow), ">=" & AA, ws.Range("G4:G" & lastRow), "<=" & BB)
CC = count
Next
End Sub
请各位老师帮忙!
名册1.rar
(195.73 KB, 下载次数: 3)
|
|