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!:eeek:

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

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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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