|
- Sub lqxs()
- Dim myPath$, myName$, wb As Workbook, rng As Range
- Dim funm$, n&, m&, nm$, Myc%
- Application.ScreenUpdating = False
- Set wb = ThisWorkbook
- funm = ThisWorkbook.Name
- Sheet1.Activate
- Cells.Clear
- myPath = ThisWorkbook.Path & ""
- myName = Dir(myPath & "*.xlsx")
- Do While myName <> "" And myName <> funm
- With GetObject(myPath & myName)
- n = n + 1
- nm = Split(myName, ".")(0)
- If n = 1 Then
- .Sheets("初稿").[a1].CurrentRegion.Copy Cells(n, 2): [a1] = "区域"
- m = Cells(Rows.Count, 2).End(xlUp).Row
- Myc = [iv1].End(xlToLeft).Column
- [a2].Resize(m - 1, 1) = nm
- Rows(m).EntireRow.Delete
- Else
- Set rng = .Sheets("初稿").[a1].CurrentRegion
- Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 2, Myc - 1)
- m = Cells(Rows.Count, 2).End(xlUp).Row + 1
- rng.Copy Cells(m, 2)
- Cells(m, 1).Resize(rng.Rows.Count, 1) = nm
- End If
- .Close False
- End With
- myName = Dir
- Loop
- m = Cells(Rows.Count, 2).End(xlUp).Row
- [a2].Resize(m - 1, 1).Borders.LineStyle = 1
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|