Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Create two sheets, filter data to each
Sub SplitSheet()
Set OldSht = ActiveSheet Set ABCSht = Sheets.Add(after:=Sheets(Sheets.Count)) ABCSht.Name = "ABC" 'copy header row OldSht.Rows(1).Copy _ Destination:=ABCSht.Rows(1) ABCRowCount = 2 Set DEFSht = Sheets.Add(after:=Sheets(Sheets.Count)) ABCSht.Name = "DEF" 'copy header row OldSht.Rows(1).Copy _ Destination:=DEFSht.Rows(1) DEFRowCount = 2 With OldSht LastRow = .Range("A" & Rows.Count).End(xlUp).Row For RowCount = 2 To LastRow ItemName = Range("A" & RowCount) Select Case UCase(ItemName) Case "ABC" .Rows(RowCount).Copy _ Destination:=ABCSht.Rows(ABCRowCount) ABCRowCount = ABCRowCount + 1 Case "DEF" .Rows(RowCount).Copy _ Destination:=DEFSht.Rows(DEFRowCount) DEFRowCount = DEFRowCount + 1 End Select Next RowCount OldSht.Delete End With End Sub "J.W. Aldridge" wrote: Sheet X has data in A:H. (No headers) For each row with data, column A will contain either "abc" or "def". I need to create two sheets 1 - "ABC Group" 2 - "DEF Group" Filter all rows with abc in A to sheet ABC Group. Filter all rows with def in A to sheet DEF Group. Delete the original sheet - SheetX |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pivot Data and Filter on separate sheets | Excel Discussion (Misc queries) | |||
Create two sheets, filter data to each | Excel Programming | |||
Hyperlink and Filter Data in Multiple Sheets | Excel Discussion (Misc queries) | |||
Create Multiple Filter and graph data | Excel Programming | |||
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA | Excel Worksheet Functions |