VBA를 사용하여 대량의 Excel 파일에서 데이터를 모호하게 가져와 새 표를 생성합니다 (실례 첨부). - (4) 환자의 병례를 결합하여 실례를 대량으로 집계합니다.
3766 단어 Excel
지금 제가 쓴 sub 내용 중 하나를 직접 붙일게요.완전한 내용은 자원에서 보십시오.
Sub GetATValue()
Debug.Print
Debug.Print "Start ++++++++++++++++++++++++++++++++++++"
Dim RootFolder, FolderArray(), FolderName, CurrentFolderPath, FileName, CurrentFilePath
'
RootFolder = ActiveWorkbook.Path & "\" '
Debug.Print " :" & RootFolder
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim sheet As Excel.Worksheet
Dim cAddress
Set xlApp = New Excel.Application
Dim PAT
Dim startRow, endRow
startRow = 2
endRow = 359
Do While startRow <= endRow
FileName = Cells(startRow, 1)
CurrentFilePath = RootFolder & FileName
Debug.Print CurrentFilePath
'
' excel
Set xlBook = xlApp.Workbooks.Open(CurrentFilePath)
' sheet
Set sheet = xlBook.Worksheets(1)
'AT
With sheet.Range("A15:C24")
Set c = .Find("AT", LookIn:=xlValues)
If Not c Is Nothing Then
tempRow = c.Row
PAT = ""
PAT = sheet.Cells(c.Row, c.Column + 1)
If PAT = "" Then PAT = sheet.Cells(c.Row, c.Column + 2)
If PAT = "" Then PAT = sheet.Cells(c.Row, c.Column + 3)
End If
End With
xlBook.Close False
Cells(startRow, 4) = PAT
startRow = startRow + 1
Loop
Debug.Print "End ++++++++++++++++++++++++++++++++++++"
End Sub
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Excel Grep toolExcel Grep tool ■히나가타 ■ 시트 구성 ExcelGrep.cls...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.