|
短信收到,请测试- Sub Macro1()
- Dim MyPath$, MyName$, arr, brr(1 To 100000, 1 To 6), MyDate As Date, i&, j&, m&
- MyPath = ThisWorkbook.Path & ""
- MyName = Dir(MyPath & "*.xls")
- Application.ScreenUpdating = False
- Do While MyName <> ""
- If MyName <> ThisWorkbook.Name Then
- a = Split(MyName, "年")
- MyDate = 20 & Right(a(0), 2) & "-" & Split(a(1), "月")(0) & "-1"
- With GetObject(MyPath & MyName)
- arr = .Sheets(1).UsedRange
- .Close False
- End With
- For i = 3 To UBound(arr)
- For j = 2 To 37 Step 4
- m = m + 1
- brr(m, 1) = arr(i, 1)
- brr(m, 2) = arr(1, j)
- brr(m, 3) = arr(i, j)
- brr(m, 4) = arr(i, j + 1)
- brr(m, 5) = arr(i, j + 2)
- brr(m, 6) = MyDate
- Next
- Next
- End If
- MyName = Dir
- Loop
- [a1].CurrentRegion.Offset(1).ClearContents
- [a2].Resize(m, 6) = brr
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|