Beginner Help - How to filter more then one worksheet

KathrynMcG

New Member
Joined
Jul 17, 2012
Messages
5
Hi,

I am a total beginner to this, having only learnt about VBA in the last 24 hours.

However, this is what i'm trying to do:

We have a workbook with several worksheets. Each one represents a different area of our factory. Currently they are used for auditing purposes, with questions, and a score given and jobs listed to be fixed againt each question.

What we want to be able to do is to assign a code to each job (or row) on each worksheet (e.g. ENG for engineers) for who needs to fix it, and then have those jobs automatically populate on a different worksheet for each "person". So one for ENG jobs and QA jobs etc.

I googled it and borrowed some coding from another person who wanted a similar thing.

I have got it to work, but only for one worksheet, i.e. it will only search the sheet ("Lab & Offices") when I ultimately want it to seach all sheets.

Is there a way to define all sheets in workbook, or a range of sheets? Being a complete beginner, i'm sure it must be easy but i just don't know the correct coding for it.

This is what I have:

Option Explicit
Private Sub Worksheet_Activate()
Dim LR As Long

Me.UsedRange.Offset(1).ClearContents 'clear existing data

With Sheets("Lab & Offices")
.AutoFilterMode = False 'remove any prior filtering
.Rows(1).AutoFilter 'activate autofilter
.Rows(1).AutoFilter 6, ">=QA" 'filter column F for QA
LR = .Range("A" & .Rows.Count).End(xlUp).Row 'is any data visible?
If LR > 1 Then
.Range("A2:G" & LR).Copy Range("A2") 'copy any data visible to report
Else
Range("A2") = "no data found" 'if none, give that message
End If
.AutoFilterMode = False 'turn off autofilter

End With

End Sub


What I want to know is how to get it to look further than the "Lab & Offices" sheet (which is sheet 11). I want to look through sheets 2 to 11 for references to QA in column 6 (or F).

Appreciate any help!! (p.s. using Excel 2010)
 
Last edited:
AS I said in post #4, you are pasting back over your own data, because you don't have a sheet reference.
Rich (BB code):
If LR > 1 Then
        .Range("A2:G" & LR).Copy Range("A2") 

Might need to be

If LR > 1 Then
        .Range("A2:G" & LR).Copy Sheets(SHEETNAME).Range("A2")   'change sheet name to whatever the report sheet is
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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