|
发表于 2017-4-25 11:01
|
显示全部楼层
本楼为最佳答案
- Sub aaa()
- Dim arr, i&, sh As Worksheet, rng As Range
- arr = [a1].CurrentRegion
- Application.ScreenUpdating = False
- Workbooks.Open ThisWorkbook.Path & "\test2.xlsx"
- For i = 2 To UBound(arr)
- If arr(i, 3) <> "" Then
- For Each sh In Worksheets
- Set rng = sh.Cells.Find(arr(i, 3), lookat:=xlWhole)
- If Not rng Is Nothing Then Exit For
- Next sh
- arr(i, 4) = rng.Offset(, -1)
- arr(i, 5) = sh.Name
- End If
- Next i
- ActiveWorkbook.Close
- [a1].CurrentRegion = arr
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|