版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kese7952/article/details/80276116
课件下载 :
方式1:本节课件下载地址: https://pan.baidu.com/s/1D-MvbRcJRoyiA456xsTvMQ 密码:rzlr
方式2:或点击此处下载
效果图:
代码示例:
Sub tongji()
Dim i, k, l, m As Integer
For i = 2 To Sheets.Count
k = k + Application.WorksheetFunction.CountA(Sheets(i).Range("a:a")) - 1'不算表头
l = l + Application.WorksheetFunction.CountIf(Sheets(i).Range("f:f"), "男")
m = m + Application.WorksheetFunction.CountIf(Sheets(i).Range("f:f"), "女")
Next
Sheet1.Range("d26") = k
Sheet1.Range("d27") = l
Sheet1.Range("d28") = m
End Sub
-------------------------------------------------------------------------------------------------------------
Sub chaxun()
On Error Resume Next'错误回避(遇到错误,跳过,继续执行下一行)
Sheet1.Range("d14").ClearContents'对Sheet1表中D14单元格进行清除内容
For i = 2 To Sheets.Count
Sheet1.Range("d14") = Application.WorksheetFunction.VLookup(Sheet1.Range("d9"), Sheets(i).Range("a:h"), 5, 0)
Sheet1.Range("d16") = Application.WorksheetFunction.VLookup(Sheet1.Range("d9"), Sheets(i).Range("a:h"), 6, 0)
Sheet1.Range("d18") = Application.WorksheetFunction.VLookup(Sheet1.Range("d9"), Sheets(i).Range("a:h"), 3, 0)
Sheet1.Range("d20") = Application.WorksheetFunction.VLookup(Sheet1.Range("d9"), Sheets(i).Range("a:h"), 8, 0)
Sheet1.Range("d22") = Sheets(i).Name
If Sheet1.Range("d14") <> "" Then
Exit For
End If
Next
End Sub
作者: 杨校
出处: https://blog.csdn.net/kese7952
分享是快乐的,也见证了个人成长历程,文章大多都是工作经验总结以及平时学习积累,基于自身认知不足之处在所难免,也请大家指正,共同进步。
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出, 如有问题, 可邮件(397583050@qq.com)咨询。