Last active
July 20, 2020 12:23
-
-
Save johngrib/5293a133d74796b7203e7a78344d1ba6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub exe() | |
Dim i As Integer | |
Dim j As Integer | |
Dim lastRow As Integer | |
Dim cUp As Double | |
Dim cDown As Double | |
lastRow = 8 ' 자료가 있는 마지막 행의 숫자를 적습니다. | |
' 3번 행부터 마지막 행까지 작업합니다. | |
For i = 3 To lastRow Step 1 | |
Set Base = Cells(i, 1) ' Base는 작업의 기준이 될 A열의 값입니다. | |
' C 열에서 조건에 해당하는 행을 찾습니다. | |
For j = 3 To lastRow Step 1 | |
cUp = Cells(j, 3) | |
cDown = Cells(j + 1, 3) | |
If cDown < Base And Base < cUp Then | |
' C 열에서 위아래 값이 Base를 포함하는 곳을 찾았다면 B열에 D열의 값을 복사합니다. | |
Cells(i, 2) = Cells(j + 1, 4) | |
Exit For | |
End If | |
Next | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment