VBAの簡略化について
VBAで数値をカウントするマクロを作りました。
Dim Co1 As Integer
Co1 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<1")
Dim Co2 As Integer
Co2 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<2")
Dim Co3 As Integer
Co3 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<3")
Dim Co4 As Integer
Co4 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<4")
Dim Co5 As Integer
Co5 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<5")
Dim Co6 As Integer
Co6 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<6")
Dim Co7 As Integer
Co7 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<7")
Dim Co8 As Integer
Co8 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<8")
Dim Co9 As Integer
Co9 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<9")
Dim Co10 As Integer
Co10 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), "<10")
Dim Co11 As Integer
Co11 = WorksheetFunction.CountIf(Range(Cells(○, ○), Cells(○, ○)), ">=10")
Cells(2, 1) = Co1
Cells(3, 1) = Co2 - Co1
Cells(4, 1) = Co3 - Co2
Cells(5, 1) = Co4 - Co3
Cells(6, 1) = Co5 - Co4
Cells(7, 1) = Co6 - Co5
Cells(8, 1) = Co7 - Co6
Cells(9, 1) = Co8 - Co7
Cells(10, 1) = Co9 - Co8
Cells(11, 1) = Co10 - Co9
Cells(12, 1) = Co11
Cells(2, 1) = "0~0.999"
Cells(3, 1) = "1~1.999"
Cells(4, 1) = "2~2.999"
Cells(5, 1) = "3~3.999"
Cells(6, 1) = "4~4.999"
Cells(7, 1) = "5~5.999"
Cells(8, 1) = "6~6.999"
Cells(9, 1) = "7~7.999"
Cells(10, 1) = "8~8.999"
Cells(11, 1) = "9~9.999"
Cells(12, 1) = "10~"
これを短くする方法を教えてください。
お礼
ありがとうございました!