엑셀/VBA
vba-30초봉 분봉으로 변환
gongdol
2024. 3. 10. 00:26
300x250
1. 예제파일
2. 코드작성
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
Sub minute_bong()
last_row = Cells(Rows.Count, 1).End(3).Row
start_pos = 10 '시작위치
FOR_IDX = 2
c = FOR_IDX
pre_index_row = FOR_IDX - 1
START_COND = 1
For ii = FOR_IDX To last_row Step 2
'1. 봉축소하기 30 ->1분
Cells(c, start_pos).Value = Abs(Cells(ii, 3).Value)
Cells(c, start_pos + 1).Value = Abs(WorksheetFunction.Max(Range("D" & ii & ":" & "D" & ii + 1)))
Cells(c, start_pos + 2).Value = Abs(WorksheetFunction.Min(Range("E" & ii & ":" & "E" & ii + 1)))
Cells(c, start_pos + 3).Value = Abs(Cells(ii + 1, 6).Value)
c = c + 1
Next
MsgBox ("완료")
End Sub
|
cs |
3. 결과
300x250