Autofilter for multiple sheets which may/may not have the data

abschy

New Member
Joined
Mar 20, 2019
Messages
23
Hi all

Ive been having some errors with this part of my code in bold.

as i have this code run for 4 different sheets, each sheet will come back with different data, some sheets even with no data.

this code works fine on 1 sheet, and the rest keeps getting stuck at the bolded part even though the sheet has the data.

would really appreciate any help!!

Thank you!!

Code:
  ' get project name
   Worksheets("Find Project").Range("F8").Copy
    
     'filter projects
   Sheets("OPEX_OTHERS_DATA").Select
[B]   ActiveSheet.ListObjects("OPEX_OTHERS").Range.AutoFilter Field:=3, Criteria1 _[/B]
[B]        :=Sheets("Find Project").Range("F8")[/B]

    ' copy data without headers
    Range("OPEX_OTHERS[#All]").Offset(1, 0).Copy
    
    
    'paste data in project data sheet
    Sheets("Project Data").Activate
    Cells(1, 1).PasteSpecial xlPasteValues
    
    'unfilter data
    Worksheets("OPEX_OTHERS_DATA").Select
    Worksheets("OPEX_OTHERS_DATA").ShowAllData
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
10,205
Office Version
2007
Platform
Windows
What does the error message say?
I tested the code and it works for me in both ways with data in the table or without data.
 

Forum statistics

Threads
1,089,637
Messages
5,409,464
Members
403,265
Latest member
HMR120

This Week's Hot Topics

Top