VBA Code to Filter Copy and Paste into New Woorksheet and name each new worksheet with filtered value

Oxon258

New Member
Joined
Oct 29, 2016
Messages
9
I have a large dataset that I want to filter by values in column A.

I then wish to copy all values within that filter to a new worksheet in the same workbook.

I wish to name the worksheet after the filtered value.

I then wish to repeat this for all unique values within the dataset, each time transferring the next dataset to another new worksheet and name the given sheet after the unique filter value.

I've recorded this, but non of it has unique values or anything that makes it flexible.

I'd be real pleased for someone's help!:eek:

-----------------------------------------------------------------------------

Sub FilterCPY_PST()
'
' FilterCPY_PST Macro
'
' Keyboard Shortcut: Ctrl+r
'
Columns("A:A").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$A$7879").AutoFilter Field:=1, Criteria1:= _
"0_50m_sc1_B10_00m"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
End Sub
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Watch MrExcel Video

Forum statistics

Threads
1,130,210
Messages
5,640,865
Members
417,174
Latest member
diegomuser

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
Top