Function DrawRactangle(startrow As Integer, startcol As Integer, perhour As Integer, aftertime As Variant, howlongtime As Variant)
'startrow는 startcol과는다르다 지금 몇번째 줄에 쓸차레다를 알려주는 정보
'startcol은 처음에 그래프그린게 몇번째칼럼이였다라는것을 알려준다
'perhour는 몇칸을 한시간으로 칠꺼냐다. 예)perhour=2 이면 2칸이 1시간이다.
'aftertime은 처음 그래프 그린후부터 몇시간 지났다는것을 알려준다.
'howlongtime은 aftertime부터 그래프를 그려서 얼마나 시간동안 그릴것인가를 알려준다
Dim minuteendandstartwidth As Integer
Dim startx As Integer
Dim starty As Integer
Dim height As Variant
Dim length As Integer
startcol = startcol - 1 '시작 컬럼 값이 0부터가 아니고 1부터라서 1을 빼준다
starty = ThisWorkbook.ActiveSheet.Range(Cells(1, 1), Cells(startrow - 1, 1)).height + 1
startx = ThisWorkbook.ActiveSheet.Range(Cells(1, 1), Cells(1, startcol + perhour * hour(aftertime))).width _
+ ThisWorkbook.ActiveSheet.Range(Cells(1, startcol + 1 + perhour * hour(aftertime)), Cells(1, startcol + perhour * (1 + hour(aftertime)))).width / 60 * Minute(aftertime) _
+ 1
''''여기까지가 시작위치정하게된것
''''높이
heigth = ThisWorkbook.ActiveSheet.Cells(startrow, 1).Rows.RowHeight - 3
'''''길이
length = ThisWorkbook.ActiveSheet.Range(Cells(1.1), Cells(1, startcol + perhour * hour(aftertime + howlongtime))).width _
+ ThisWorkbook.ActiveSheet.Range(Cells(1, startcol + 1 + perhour * hour(aftertime + howlongtime)), Cells(1, startcol + perhour * (hour(aftertime + howlongtime) + 1))).width / 60 * Minute(aftertime + howlongtime) _
- startx
ActiveSheet.Shapes.AddShape(msoShapeRectangle, startx, starty, length, heigth). _
Select
End Function