Advanced Filtering Copy certain columns

Philips

New Member
Joined
Jul 13, 2015
Messages
6
I'm using Advanced Filtering and the code is copying all the filtered rows to a new tab. Now I don't want to copy everything but only selected columns by range.
Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">[COLOR=#000000]Sheets[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"Data"[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"Tabel1[#All]"[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]AdvancedFilter Action[/COLOR][COLOR=#000000]:=[/COLOR][COLOR=#000000]xlFilterCopy[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] CriteriaRange[/COLOR][COLOR=#000000]:=[/COLOR][COLOR=#000000] _
Sheets[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"Data"[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"AG1:AL2"[/COLOR][COLOR=#000000]),[/COLOR][COLOR=#000000]CopyToRange[/COLOR][COLOR=#000000]:=[/COLOR][COLOR=#000000]Sheets[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]“Filter”[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]“B10″), Unique:=True
 [/COLOR]</code>
I've tried something like this but there is a syntax error:
Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">[COLOR=#000000]Sheets[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"Data"[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"Tabel1[#All]"[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]AdvancedFilter[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] CriteriaRange[/COLOR][COLOR=#000000]:=[/COLOR][COLOR=#000000] _
Sheets[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"Data"[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"AG1:AL2"[/COLOR][COLOR=#000000]),[/COLOR][COLOR=#000000]Sheets[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"Data"[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"A1"[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Copy _
destination[/COLOR][COLOR=#000000]:=[/COLOR][COLOR=#000000]Sheets[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"Filter"[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"B10"[/COLOR][COLOR=#000000]),[/COLOR][COLOR=#000000]Unique[/COLOR][COLOR=#000000]:=[/COLOR][COLOR=#800000]True
[/COLOR]</code>
Any ideas how to select certain columns?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Welcome to Mr Excel

Not sure if i understand what you need, but let me try. Suppose you have a table with four columns and you want the Advanced Filter makes a copy of only two columns, for example, Name and Value.

Put the columns' headers you want to copy (Name and Value) in Sheets Filter B10:C10 and in Advanced Filter, use
Copy to: Filter!B10:C10

Hope this helps

M.
 
Upvote 0
Welcome to Mr Excel

Not sure if i understand what you need, but let me try. Suppose you have a table with four columns and you want the Advanced Filter makes a copy of only two columns, for example, Name and Value.

Put the columns' headers you want to copy (Name and Value) in Sheets Filter B10:C10 and in Advanced Filter, use
Copy to: Filter!B10:C10

Hope this helps

M.

Thanks for your answer, I fixed it already...
 
Upvote 0

Forum statistics

Threads
1,216,411
Messages
6,130,440
Members
449,581
Latest member
econtent2

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