If you mean find all rows that contain "Pending" in column J, what do you want to do with those rows after they are found? It is hard to work with a picture. It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).find all PENDING ORDER
Respected,If you mean find all rows that contain "Pending" in column J, what do you want to do with those rows after they are found? It is hard to work with a picture. It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
Sub CopyPending()
Application.ScreenUpdating = False
Dim ws As Worksheet, lRow As Long, desWS As Worksheet
Set desWS = Sheets("Pending")
For Each ws In Sheets
If ws.Name <> "Pending" Then
With ws
lRow = .Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
If WorksheetFunction.CountIf(.Range("J1:J" & lRow), "*Pending*") > 1 Then
.Range("J1:J" & lRow).AutoFilter 1, "*Pending*"
.AutoFilter.Range.Offset(1).EntireRow.Copy desWS.Cells(desWS.Rows.Count, 1).End(xlUp).Offset(1)
End If
.Range("J1").AutoFilter
End With
End If
Next ws
Application.ScreenUpdating = True
End Sub
Start by inserting a new blank sheet and name it "Pending". Then try this macro:
VBA Code:Sub CopyPending() Application.ScreenUpdating = False Dim ws As Worksheet, lRow As Long, desWS As Worksheet Set desWS = Sheets("Pending") For Each ws In Sheets If ws.Name <> "Pending" Then With ws lRow = .Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row If WorksheetFunction.CountIf(.Range("J1:J" & lRow), "*Pending*") > 1 Then .Range("J1:J" & lRow).AutoFilter 1, "*Pending*" .AutoFilter.Range.Offset(1).EntireRow.Copy desWS.Cells(desWS.Rows.Count, 1).End(xlUp).Offset(1) End If .Range("J1").AutoFilter End With End If Next ws Application.ScreenUpdating = True End Sub