Vũ Tuấn Tùng
Thành viên mới
- Tham gia
- 22/6/16
- Bài viết
- 27
- Được thích
- 2
Nhờ các anh chị em trên diễn đàn sửa giúp em đoạn code này để cho gọn chứ nhập tay lâu quá ạ. . . em xin cảm ơn ạ. . .
Mã:
Sub Tinh()
With Sheet1
.Range("B3") = Application.CountIf(.Range("H1:QQQ200"), .Range("A3")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B4") = Application.CountIf(.Range("H1:QQQ200"), .Range("A4")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B5") = Application.CountIf(.Range("H1:QQQ200"), .Range("A5")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B6") = Application.CountIf(.Range("H1:QQQ200"), .Range("A6")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B7") = Application.CountIf(.Range("H1:QQQ200"), .Range("A7")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B8") = Application.CountIf(.Range("H1:QQQ200"), .Range("A8")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B9") = Application.CountIf(.Range("H1:QQQ200"), .Range("A9")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B10") = Application.CountIf(.Range("H1:QQQ200"), .Range("A10")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B11") = Application.CountIf(.Range("H1:QQQ200"), .Range("A11")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B12") = Application.CountIf(.Range("H1:QQQ200"), .Range("A12")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B13") = Application.CountIf(.Range("H1:QQQ200"), .Range("A13")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B14") = Application.CountIf(.Range("H1:QQQ200"), .Range("A14")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B15") = Application.CountIf(.Range("H1:QQQ200"), .Range("A15")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B16") = Application.CountIf(.Range("H1:QQQ200"), .Range("A16")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B17") = Application.CountIf(.Range("H1:QQQ200"), .Range("A17")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B18") = Application.CountIf(.Range("H1:QQQ200"), .Range("A18")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B19") = Application.CountIf(.Range("H1:QQQ200"), .Range("A19")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B20") = Application.CountIf(.Range("H1:QQQ200"), .Range("A20")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B21") = Application.CountIf(.Range("H1:QQQ200"), .Range("A21")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B22") = Application.CountIf(.Range("H1:QQQ200"), .Range("A22")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B23") = Application.CountIf(.Range("H1:QQQ200"), .Range("A23")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B24") = Application.CountIf(.Range("H1:QQQ200"), .Range("A24")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B25") = Application.CountIf(.Range("H1:QQQ200"), .Range("A25")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B26") = Application.CountIf(.Range("H1:QQQ200"), .Range("A26")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B27") = Application.CountIf(.Range("H1:QQQ200"), .Range("A27")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B28") = Application.CountIf(.Range("H1:QQQ200"), .Range("A28")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B29") = Application.CountIf(.Range("H1:QQQ200"), .Range("A29")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B30") = Application.CountIf(.Range("H1:QQQ200"), .Range("A30")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B31") = Application.CountIf(.Range("H1:QQQ200"), .Range("A31")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B32") = Application.CountIf(.Range("H1:QQQ200"), .Range("A32")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B33") = Application.CountIf(.Range("H1:QQQ200"), .Range("A33")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B34") = Application.CountIf(.Range("H1:QQQ200"), .Range("A34")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B35") = Application.CountIf(.Range("H1:QQQ200"), .Range("A35")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B36") = Application.CountIf(.Range("H1:QQQ200"), .Range("A36")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B37") = Application.CountIf(.Range("H1:QQQ200"), .Range("A37")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B38") = Application.CountIf(.Range("H1:QQQ200"), .Range("A38")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B39") = Application.CountIf(.Range("H1:QQQ200"), .Range("A39")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B40") = Application.CountIf(.Range("H1:QQQ200"), .Range("A40")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B41") = Application.CountIf(.Range("H1:QQQ200"), .Range("A41")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B42") = Application.CountIf(.Range("H1:QQQ200"), .Range("A42")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B43") = Application.CountIf(.Range("H1:QQQ200"), .Range("A43")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B44") = Application.CountIf(.Range("H1:QQQ200"), .Range("A44")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B45") = Application.CountIf(.Range("H1:QQQ200"), .Range("A45")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B46") = Application.CountIf(.Range("H1:QQQ200"), .Range("A46")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B47") = Application.CountIf(.Range("H1:QQQ200"), .Range("A47")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B48") = Application.CountIf(.Range("H1:QQQ200"), .Range("A48")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B49") = Application.CountIf(.Range("H1:QQQ200"), .Range("A49")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B50") = Application.CountIf(.Range("H1:QQQ200"), .Range("A50")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B51") = Application.CountIf(.Range("H1:QQQ200"), .Range("A51")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B52") = Application.CountIf(.Range("H1:QQQ200"), .Range("A52")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B53") = Application.CountIf(.Range("H1:QQQ200"), .Range("A53")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B54") = Application.CountIf(.Range("H1:QQQ200"), .Range("A54")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B55") = Application.CountIf(.Range("H1:QQQ200"), .Range("A55")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B56") = Application.CountIf(.Range("H1:QQQ200"), .Range("A56")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B57") = Application.CountIf(.Range("H1:QQQ200"), .Range("A57")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B58") = Application.CountIf(.Range("H1:QQQ200"), .Range("A58")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B59") = Application.CountIf(.Range("H1:QQQ200"), .Range("A59")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B60") = Application.CountIf(.Range("H1:QQQ200"), .Range("A60")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B61") = Application.CountIf(.Range("H1:QQQ200"), .Range("A61")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B62") = Application.CountIf(.Range("H1:QQQ200"), .Range("A62")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B63") = Application.CountIf(.Range("H1:QQQ200"), .Range("A64")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B64") = Application.CountIf(.Range("H1:QQQ200"), .Range("A65")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B65") = Application.CountIf(.Range("H1:QQQ200"), .Range("A65")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B66") = Application.CountIf(.Range("H1:QQQ200"), .Range("A66")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B67") = Application.CountIf(.Range("H1:QQQ200"), .Range("A67")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B68") = Application.CountIf(.Range("H1:QQQ200"), .Range("A68")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B69") = Application.CountIf(.Range("H1:QQQ200"), .Range("A69")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B70") = Application.CountIf(.Range("H1:QQQ200"), .Range("A70")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B71") = Application.CountIf(.Range("H1:QQQ200"), .Range("A71")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B72") = Application.CountIf(.Range("H1:QQQ200"), .Range("A72")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B73") = Application.CountIf(.Range("H1:QQQ200"), .Range("A73")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B74") = Application.CountIf(.Range("H1:QQQ200"), .Range("A74")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B75") = Application.CountIf(.Range("H1:QQQ200"), .Range("A75")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B76") = Application.CountIf(.Range("H1:QQQ200"), .Range("A76")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B77") = Application.CountIf(.Range("H1:QQQ200"), .Range("A77")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B78") = Application.CountIf(.Range("H1:QQQ200"), .Range("A78")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B79") = Application.CountIf(.Range("H1:QQQ200"), .Range("A79")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B80") = Application.CountIf(.Range("H1:QQQ200"), .Range("A80")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B81") = Application.CountIf(.Range("H1:QQQ200"), .Range("A81")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B82") = Application.CountIf(.Range("H1:QQQ200"), .Range("A82")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B83") = Application.CountIf(.Range("H1:QQQ200"), .Range("A83")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B84") = Application.CountIf(.Range("H1:QQQ200"), .Range("A84")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B85") = Application.CountIf(.Range("H1:QQQ200"), .Range("A85")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B86") = Application.CountIf(.Range("H1:QQQ200"), .Range("A86")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B87") = Application.CountIf(.Range("H1:QQQ200"), .Range("A87")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B88") = Application.CountIf(.Range("H1:QQQ200"), .Range("A88")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B89") = Application.CountIf(.Range("H1:QQQ200"), .Range("A89")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B90") = Application.CountIf(.Range("H1:QQQ200"), .Range("A90")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B91") = Application.CountIf(.Range("H1:QQQ200"), .Range("A91")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B92") = Application.CountIf(.Range("H1:QQQ200"), .Range("A92")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B93") = Application.CountIf(.Range("H1:QQQ200"), .Range("A93")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B94") = Application.CountIf(.Range("H1:QQQ200"), .Range("A94")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B95") = Application.CountIf(.Range("H1:QQQ200"), .Range("A95")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B96") = Application.CountIf(.Range("H1:QQQ200"), .Range("A96")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B97") = Application.CountIf(.Range("H1:QQQ200"), .Range("A97")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B98") = Application.CountIf(.Range("H1:QQQ200"), .Range("A98")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B99") = Application.CountIf(.Range("H1:QQQ200"), .Range("A99")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B100") = Application.CountIf(.Range("H1:QQQ200"), .Range("A100")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B101") = Application.CountIf(.Range("H1:QQQ200"), .Range("A101")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B102") = Application.CountIf(.Range("H1:QQQ200"), .Range("A102")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B103") = Application.CountIf(.Range("H1:QQQ200"), .Range("A103")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B104") = Application.CountIf(.Range("H1:QQQ200"), .Range("A104")) / Application.CountA(.Range("H1:QQQ1"))
.Range("B105") = Application.CountIf(.Range("H1:QQQ200"), .Range("A105")) / Application.CountA(.Range("H1:QQQ1"))
End With
End Sub