Particular value in every worksheet

someone21

Board Regular
Joined
Sep 16, 2011
Messages
71
I want to get a macro, not anything related with auto filter.

The issue is I want to get all the rows in all the worksheets except "main" which contain a cell value of "good" in the column C which is to be pasted into the "main" worksheet.Thereby, becoming a kind of like a summary of the "good" rows in other worksheets
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
liverpooll21,

Not sure why you wouldn't want to use autofilter for something like this. Even the macro uses it:
Code:
Sub tgr()
    
    Static wsMain As Worksheet: Set wsMain = ActiveWorkbook.Sheets("main")
    
    Dim ws As Worksheet
    Dim rngDest As Range
    
    For Each ws In ActiveWorkbook.Sheets
        If ws.Name <> "main" Then
            Set rngDest = wsMain.Cells(Rows.Count, wsMain.UsedRange.Column).End(xlUp).Offset(1, 0)
            With Intersect(ws.UsedRange, ws.Columns("C"))
                .AutoFilter 1, "good"
                .Offset(1).EntireRow.Copy rngDest
                .AutoFilter
            End With
        End If
    Next ws
    
End Sub



Hope that helps,
~tigeravatar
 
Upvote 0
Thanks, similar question,

now I want to get everyrow which contains any text into the main worksheet? how to do that?
 
Upvote 0
Code:
'Replace "good" with desired text to search for
'If you're simply searching for non-blank cells, replace "good" with "<>"
'This replacement is in the following line:
 
.AutoFilter 1, "good"
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top