|
* 답변하시는 분들께 도움이 되도록 자신의 환경을 아래 항목 옆에 기재해 주세요.
- 엑셀 버전(2007):
* 아래줄에 질문을 작성하세요 >>
데이터 시트에 일자별 발주량과 입고량 입고율이 있습니다.여기서...
입고현황 시트에 일자별 각 아이템별 입고량만 가져올수 없나요???
여기 나와있는건 7가지 이지만.... 몃천가지아이템 정도 있거등요.. 수작업 불가합니다...
그리고 데이터부분은 자동으로 엑셀 변환되는 부분이라서 양식을 건들이지 않고 그대로 두어야 합니다...
==============[전주임님 글에 대한 답변입니다]==============
데이터량이 방대할 경우 VBA로 작업을 하는 것이 좋을 것 같습니다.
첨부화일 참고하세요...
Sub getAmountOfStorage()
Dim sht As Worksheet, shtDB As Worksheet
Dim rData As Range
Dim lRow As Long
Dim rFindGood As Range, rFIndDay As Range, sAddr As String
Dim sDay As String, sGood As String
Dim bFound As Boolean
Const sGu As String = "입고"
Set sht = Worksheets("입고현황")
Set shtDB = Worksheets("DATA")
Set rData = shtDB.Range("A1").CurrentRegion
For lRow = 6 To sht.Cells(Rows.Count, 2).End(xlUp).Row
sDay = Day(sht.Cells(lRow, 2)) & "일"
sGood = sht.Cells(lRow, 3)
bFound = False
Set rFindGood = rData.Columns(2).Find(What:=sGood, LookAt:=xlWhole)
If Not rFindGood Is Nothing Then
Set rFIndDay = rData.Rows(1).Find(What:=sDay, LookAt:=xlWhole)
If Not rFIndDay Is Nothing Then
sAddr = rFIndDay.Address
Do
If rFIndDay.Offset(1) = sGu Then
bFound = True
Exit Do
End If
Set rFIndDay = rData.Rows(1).FindNext(rFIndDay)
Loop While Not rFIndDay Is Nothing And sAddr <> rFIndDay.Address
End If
End If
If bFound Then
sht.Cells(lRow, "E") = shtDB.Cells(rFindGood.Row, rFIndDay.Column)
End If
Next
End Sub
|
|