- Sub test0() '参与一下
- Dim wks As Worksheet, Cel As Range
- Dim ar, r As Long, c As Long, strKey As String, sStr As String
- strKey = "名称"
- For Each wks In Worksheets
- If wks.Name <> "首页" Then
- With wks
- Set Cel = .UsedRange.Find(strKey, , xlValues, xlWhole, xlByRows, xlNext)
- If Not Cel Is Nothing Then
- r = .Cells(Rows.Count, Cel.Column).End(xlUp).Row
- c = Cel.Column + 2
- sStr = sStr & ",'" & .Name & "'!" & .Range(Cel, .Cells(r, c)).Address(, , xlR1C1)
- End If
- End With
- End If
- Next
- ar = Split(Mid(sStr, 2), ",")
- With Worksheets("首页").Range("AC1")
- .CurrentRegion.ClearContents
- .Consolidate ar, xlSum, True, True
- .Value = strKey
- End With
- End Sub
复制代码 |