Hi everyone. I'm trying to write a macro to copy data from one Excel sheet to another in the same workbook when a certain criteria is met.
My data table is an import from an Access DB. After the data has been refreshed to the sheet I would like to pick out all the entries where the value in column I is "High". Once the table has been filtered the values from column A should be pasted to sheet 1("summary").
I will need more that just the information from column A, but as it's a unique ID I can just run Vlookup's off it to keep things simple for now.
I've tried a number of macro's but I'm always hanging up at the same point. Here's the code I'm using so far:
The code is debugs here:
".Range("$A$1:$ N$5000").AutoFi lter Field:=9,"
I've tried using a different macro, just to filter. Then I can use the parts of the above code to select and paste but what ever I do I get the run time error 1004 "Auto-filter method of range class failed".
I'm using Excel 2010, the data has been automatically formatted as a table when it was brought in by a data import query from Access 2003. Also, as this is only a test version the table only has 6 rows of data.
Thanks very much for any help or insight.
My data table is an import from an Access DB. After the data has been refreshed to the sheet I would like to pick out all the entries where the value in column I is "High". Once the table has been filtered the values from column A should be pasted to sheet 1("summary").
I will need more that just the information from column A, but as it's a unique ID I can just run Vlookup's off it to keep things simple for now.
I've tried a number of macro's but I'm always hanging up at the same point. Here's the code I'm using so far:
Code:
Application.ScreenUpdating = False
With Worksheets("Data")
.Range("$A$1:$N$5000").AutoFilter Field:=9, Criteria1:="High"
.Range("A:A").SpecialCells(xlCellTypeVisible).Copy _
Worksheets("Summary").Range("B18")
.Range("G:G").SpecialCells(xlCellTypeVisible).Copy _
Worksheets("Summary").Range("C18")
.Range("J:J").SpecialCells(xlCellTypeVisible).Copy _
Worksheets("Summary").Range("D18")
.Range("a1").AutoFilter
End With
Application.ScreenUpdating = True
".Range("$A$1:$ N$5000").AutoFi lter Field:=9,"
I've tried using a different macro, just to filter. Then I can use the parts of the above code to select and paste but what ever I do I get the run time error 1004 "Auto-filter method of range class failed".
I'm using Excel 2010, the data has been automatically formatted as a table when it was brought in by a data import query from Access 2003. Also, as this is only a test version the table only has 6 rows of data.
Thanks very much for any help or insight.
Comment