|
- Sub 导入文件()
- Application.ScreenUpdating = False
- Dim filename, wb As Workbook, Sh As Worksheet
- Set d = CreateObject("Scripting.Dictionary")
- filename = Dir(ThisWorkbook.Path & "\*.xls")
- Do While filename <> ""
- If filename <> ThisWorkbook.Name Then
- fn = ThisWorkbook.Path & "" & filename
- Set wb = Workbooks.Open(fn)
- For Each Sh In wb.Worksheets
- c = Sh.Cells(1, Sh.Columns.Count).End(xlToLeft).Column
- For j = 1 To c
- a = Sh.Cells(1, j).Value
- If Len(a) > 0 Then d(a) = ""
- Next
- Next
- wb.Close False
- End If
- filename = Dir
- Loop
- [a7].Resize(1, d.Count) = d.keys
- Application.ScreenUpdating = True
- End SubSub 导入文件()
- Application.ScreenUpdating = False
- Dim filename, wb As Workbook, Sh As Worksheet
- Set d = CreateObject("Scripting.Dictionary")
- filename = Dir(ThisWorkbook.Path & "\*.xls")
- Do While filename <> ""
- If filename <> ThisWorkbook.Name Then
- fn = ThisWorkbook.Path & "" & filename
- Set wb = Workbooks.Open(fn)
- For Each Sh In wb.Worksheets
- c = Sh.Cells(1, Sh.Columns.Count).End(xlToLeft).Column
- For j = 1 To c
- a = Sh.Cells(1, j).Value
- If Len(a) > 0 Then d(a) = ""
- Next
- Next
- wb.Close False
- End If
- filename = Dir
- Loop
- [a7].Resize(1, d.Count) = d.keys
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|