2015-06-05 30 views
-3

我有超過20多個標籤的大型電子表格。每個標籤具有相同的結構搜索符合條件並生成列表的所有條目的Excel工作簿選項卡?

A=ref,B= Discipline, C=Location, D=item/location, E=Defect, F=Date, G=%complete 

我想要做的就是在整個工作簿G柱搜索和返回未列出「100」的所有項目的列表。結果將顯示在摘要頁面上。

隨着時間的推移,項目列表將變得越來越小,因爲更多的項目被輸入到G列中。

你能告訴我如何做到這一點嗎? 謝謝

+2

片我敢肯定,爲「通過表循環」搜索會給你一個出發點。如果你能在求助之前證明你已經對你的問題做了一些工作/研究,那是很好的。 – ChipsLetten

+0

我會爲此嘗試searchiing。我試着看看Vlookup和我發現的幾個不同的VBA查詢。 – ellerki

+0

您可以製作多張工作表的數據透視表https://support.office.com/zh-CN/article/Consolidate-multiple-worksheets-into-one-PivotTable-report-3ae257d2-ca94-49ff-a481-e9fc8adeeeb5 – chancea

回答

0

您可以使用VBA中的Range.Find方法。

https://msdn.microsoft.com/en-us/library/office/ff839746.aspx

這是假設總會有東西在A列和複製列A:G於一種稱爲摘要

Sub Find100Percent() 

    Dim wrkSht As Worksheet 
    Dim rFoundCell As Range 
    Dim sFirstAddress As String 
    Dim shtSummary As Worksheet 

    Set shtSummary = ThisWorkbook.Worksheets("Summary") 

    For Each wrkSht In ThisWorkbook.Worksheets 
     If wrkSht.Name <> shtSummary.Name Then 
      With wrkSht.Columns(7) 
       Set rFoundCell = .Find(1, LookIn:=xlValues) 
       If Not rFoundCell Is Nothing Then 
        sFirstAddress = rFoundCell.Address 
        Do 
         rFoundCell.Offset(, -6).Resize(, 7).Copy _ 
          shtSummary.Cells(shtSummary.Rows.Count, 1).End(xlUp).Offset(1) 
         Set rFoundCell = .FindNext(rFoundCell) 
        Loop While Not rFoundCell Is Nothing And rFoundCell.Address <> sFirstAddress 
       End If 
      End With 
     End If 
    Next wrkSht 

End Sub 
相關問題