Using VBA for Filtering, Copying to new spreadsheet

kolfinna

New Member
Joined
Jun 21, 2012
Messages
9
Hi all!

I've done some searching, and quickly realized I have no idea how to even look for what I want to do. Nothing really seems to match. Basically, what I want to do is this:
  • Start with spreadsheet "Shire.xls"
  • search all records matching the unique identifier RING (returns a few thousand results)
  • Copy all those records
  • Paste over existing data in workbook "Mordor.xls" in spreadsheet "RING - all"

Subequently, I'll have to use the code to pull three other qualifiers and paste individually into their respective worksheets in Mordor. FRODO -> Frodo - All, GANDALF -> Gandalf - All, SAMWISE -> Samwise - All.

Any thoughts? I usually try to take a stab at doing the coding myself, but I'm a little overwhelmed on this one. I tried building a macro, but it choked when I tried to use an autofilter for "RING". My current process involves adding autofilters, searching within the description field of the record (the row has a lot of associated columns) for the qualifier, copy all, and then paste into Mordor.xls. When I looked at what the macro was trying to do, it was a little ridiculous...

Code:
Sub MORDOR_RING() 
' 
' MORDOR_RING Macro 
' Pulls from The Shire spreadsheet into RING - All tab
' 
' Keyboard Shortcut: Ctrl+Shift+D 
' 
    Windows("The Shire.xls").Activate 
    Selection.AutoFilter 
    ActiveSheet.Range("$A$1:$P$7863").AutoFilter Field := 11, Criteria1 := Array( _
'... (bunch of garbage for about 20 lines out of 3648 total rows to be copied) 

End Sub

Thanks in advance for all your help.
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,216,566
Messages
6,131,437
Members
449,652
Latest member
ylsteve

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