VBA to Filter copy and paste results to new sheet and rename

Eean

New Member
Joined
May 26, 2010
Messages
44
Hi,
I'm learning VBA slowly but this has me stumped!

I have a worksheet which I need to filter by Column E for every criteria listed and copy the results to a new sheet - named after the value in Column E. Then delete the data from the original sheet.

I attempted this:

Code:
Sub Chopper()
'
' Chopper Macro
'
' Keyboard Shortcut: Ctrl+Shift+Z
'
    ActiveSheet.Range("$A$1:$J$660").AutoFilter Field:=5, Criteria1:= _
        "??"
    Sheets.Add After:=Sheets(Sheets.Count)
    Sheets("Sheet1").Name = "Sheet1"
    Sheets("BUA Count").Select
    ActiveWindow.SmallScroll Down:=-9
    Range("A287:J421").Select
    ActiveWindow.SmallScroll Down:=-15
    Selection.Copy
    Sheets("Sheet1").Select
    ActiveSheet.Paste
    Cells.Select
    Cells.EntireColumn.AutoFit
    Range("E31").Select
    Sheets("BUA Count").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    ActiveSheet.Range("$A$1:$J$660").AutoFilter Field:=5
End Sub

I can't work out how to:
1. select the first criteria in autofilter rather than a specific value and
2. Rename the new sheet based on the value
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
What list where?
Sorry I'm probably explaining this badly.
I mean I need to separate my sheet into seperate sheets for each individual value (Names) within column E (there are 600 rows with around 90 different names in it)
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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