|
- Sub 我是昵称()
- Dim f As String, shts As Object, sht As Worksheet
- Dim ar, i%, s, br(), n&
- Cells.Clear
- n = 1
- s = Application.InputBox("输入大写列号多个用英文逗号隔开 “,”", " ", "D,E,F")
- If s = False Then End
- Application.ScreenUpdating = False
- f = Dir(ThisWorkbook.Path & "" & "*.xls")
- ar = Split(s, ",")
- Do While f <> ""
- If f <> ThisWorkbook.Name Then
- Set shts = GetObject(ThisWorkbook.Path & "" & f)
- For Each sht In shts.Worksheets
- For i = 0 To UBound(ar)
- With sht
- br = .Range(.Cells(1, ar(i)), .Cells(.Rows.Count, ar(i)).End(xlUp))
- br = Application.Transpose(br)
- Cells(n, 1).Resize(1, UBound(br)) = br
- n = n + 1
- End With
- Next
- Next
- Workbooks(f).Close False
- End If
- f = Dir
- Loop
- Set sht = Nothing
- Set shts = Nothing
- Application.ScreenUpdating = True
- End Sub
复制代码 你试试!
|
|