View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
scott[_8_] scott[_8_] is offline
external usenet poster
 
Posts: 12
Default Pasting to new worksheet with formats

I have a master report of customer sales. In column 10 is the sales
region. I am trying to create individual sheets by region. I have been
using Filtering to only get the data.
1)Is there a better way? and

2) Is there a way to copy the data and the formats,including column
widths. Every time I try to Paste Special Paste:xlColumnWidth I get errors.


Sub Regions()

Set lastcell = Cells.SpecialCells(xlLastCell)
ActiveSheet.Name = "ALL"
Worksheets.Add.Move after:=Worksheets(Worksheets.count)
ActiveSheet.Name = "EAST"
Worksheets.Add.Move after:=Worksheets(Worksheets.count)
ActiveSheet.Name = "CENTRAL"
Worksheets.Add.Move after:=Worksheets(Worksheets.count)
ActiveSheet.Name = "WEST"
Worksheets("ALL").Activate



Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=10, Criteria1:="EAST"
Range("A1", lastcell).Select
Selection.Copy Worksheets("EAST").Range("A1")


Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=10, Criteria1:="CENTRAL"
Range("A1", lastcell).Select
Selection.Copy Worksheets("CENTRAL").Range("A1")

Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=10, Criteria1:="WEST"
Range("A1", lastcell).Select
Selection.Copy Worksheets("WEST").Range("A1")


End Sub


Scott