|
Sub calc()
Dim i(20) As Integer
Dim gyo As Integer
'------------------------------------------------------------------------------------------------
For gyo = 1 To Cells(Rows.Count, 1).End(xlUp).Row Step 1
If Range("A" & gyo).Value >= TimeValue("7:00") And Range("A" & gyo).Value <= TimeValue("8:00") Then
i(1) = i(1) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("8:00") And Range("A" & gyo).Value <= TimeValue("9:00") Then
i(2) = i(2) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("9:00") And Range("A" & gyo).Value <= TimeValue("10:00") Then
i(3) = i(3) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("10:00") And Range("A" & gyo).Value <= TimeValue("11:00") Then
i(4) = i(4) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("11:00") And Range("A" & gyo).Value <= TimeValue("12:00") Then
i(5) = i(5) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("12:00") And Range("A" & gyo).Value <= TimeValue("13:00") Then
i(6) = i(6) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("13:00") And Range("A" & gyo).Value <= TimeValue("14:00") Then
i(7) = i(7) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("14:00") And Range("A" & gyo).Value <= TimeValue("15:00") Then
i(8) = i(8) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("15:00") And Range("A" & gyo).Value <= TimeValue("16:00") Then
i(9) = i(9) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("16:00") And Range("A" & gyo).Value <= TimeValue("17:00") Then
i(10) = i(10) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("17:00") And Range("A" & gyo).Value <= TimeValue("18:00") Then
i(11) = i(11) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("18:00") And Range("A" & gyo).Value <= TimeValue("19:00") Then
i(12) = i(12) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("19:00") And Range("A" & gyo).Value <= TimeValue("20:00") Then
i(13) = i(13) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("20:00") And Range("A" & gyo).Value <= TimeValue("21:00") Then
i(14) = i(14) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("21:00") And Range("A" & gyo).Value <= TimeValue("22:00") Then
i(15) = i(15) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("22:00") And Range("A" & gyo).Value <= TimeValue("23:00") Then
i(16) = i(16) + 1
End If
'------------------------------------------------------------------------------------------------
If Range("A" & gyo).Value >= TimeValue("23:00") And Range("A" & gyo).Value <= TimeValue("23:59") Then
i(17) = i(17) + 1
End If
'------------------------------------------------------------------------------------------------
' If Range("A" & gyo).Value >= TimeValue("24:00") And Range("A" & gyo).Value <= TimeValue("24:59") Then
' i(18) = i(18) + 1
' End If
' Cells(18, 3).Value = i(18)
'------------------------------------------------------------------------------------------------
' If Range("A" & gyo).Value >= TimeValue("0:00") And Range("A" & gyo).Value <= TimeValue("1:00") Then
' i(19) = i(19) + 1
' End If
' Cells(19, 3).Value = i(19)
Next
Cells(1, 3).Value = i(1)
Cells(2, 3).Value = i(2)
Cells(3, 3).Value = i(3)
Cells(4, 3).Value = i(4)
Cells(5, 3).Value = i(5)
Cells(6, 3).Value = i(6)
Cells(7, 3).Value = i(7)
Cells(8, 3).Value = i(8)
Cells(9, 3).Value = i(9)
Cells(10, 3).Value = i(10)
Cells(11, 3).Value = i(11)
Cells(12, 3).Value = i(12)
Cells(13, 3).Value = i(13)
Cells(14, 3).Value = i(14)
Cells(15, 3).Value = i(15)
Cells(16, 3).Value = i(16)
Cells(17, 3).Value = i(17)
'------------------------------------------------------------------------------------------------
MsgBox "集計おわり"
End Sub
お騒がせ致しました
なんとか自分で解決した感じです。
m(__)m
|
|