View Single Post
 
Old 06-22-2014, 10:41 PM
whatsup whatsup is offline Windows 7 64bit Office 2010 32bit
Competent Performer
 
Join Date: May 2014
Posts: 137
whatsup will become famous soon enough
Default

QueryTables - hm I saw your other thread afterwards...

Anyway, try if this works:
Code:
Sub Trials()
'
' Trials Macro
'
 '
With Sheets(1)
    .Range("A3").AutoFilter 'replace Range A3 by the first cell you're autofilter starts
    .ListObjects("Table_Query_from_MS_Acces s_Database").Range. _
        AutoFilter Field:=6, Criteria1:="Owner"
    .ListObjects("Table_Query_from_MS_Acces s_Database").Range. _
        AutoFilter Field:=13, Criteria1:="WA"
    .Range("Table_Query_from_MS_Access_Database[[#Headers],[First Name]]").Copy _
        Destination:=Sheets("Result").Range("A1")
End With
End Sub
Basically it's important that you can't use ActiveSheet in a macro if you start the macro from another sheet - obvious isn't it? Therefore you have to refer explicitly to the sheets name, or as above the sheets position in your workbook.
Reply With Quote