Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How about a little macro:
Option Explicit Sub testme() Dim CurWks As Worksheet Dim NewWks As Worksheet Dim oRow As Long Dim HowManyCols As Long Dim iRow As Long Dim FirstRow As Long Dim LastRow As Long Dim iCol As Long Dim FirstCol As Long Dim LastCol As Long Set CurWks = Worksheets("sheet1") Set NewWks = Worksheets.Add With CurWks FirstRow = 2 LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row FirstCol = 3 LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column HowManyCols = LastCol - FirstCol + 1 NewWks.Range("a1").Resize(1, 4).Value _ = Array("Area", "Category", "Date", "Qty") oRow = 2 For iRow = FirstRow To LastRow NewWks.Cells(oRow, "A").Resize(HowManyCols, 1).Value _ = .Cells(iRow, "A").Value NewWks.Cells(oRow, "B").Resize(HowManyCols, 1).Value _ = .Cells(iRow, "B").Value NewWks.Cells(oRow, "C").Resize(HowManyCols, 1).Value _ = Application.Transpose(.Range("c1").Resize(1, HowManyCols)) NewWks.Cells(oRow, "d").Resize(HowManyCols, 1).Value _ = Application.Transpose(.Cells(iRow, "c").Resize(1, HowManyCols)) oRow = oRow + HowManyCols Next iRow End With With NewWks .Range("c1").EntireColumn.NumberFormat = "mm/dd/yyyy" .Range("d1").EntireColumn.NumberFormat = "#,##0.00" .UsedRange.Columns.AutoFit End With End Sub If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Syak wrote: Current format is: Jul-06 Aug-2006 East Apples 5,526,415 5,520,890 West Oranges 168,822 4,652 North Peaches 8,555,579 8,886 South Pears 26,515 895,321 What I want is: East Apples Jul-06 5,526,415 East Apples Aug-06 5,520,890 West Oranges Jul-06 168,822 West Oranges Aug-06 4,652 North Peaches Jul-06 8,555,579 North Peaches Aug-06 8,886 South Pears Jul-06 8,555,579 South Pears Aug-06 895,321 "Dave O" wrote: Just so we're not talking at cross purposes... can you post some sample data in "before" and "after" format? -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Probelm opening an excel 2000 file in excel 2003 | Excel Discussion (Misc queries) | |||
Excel 2003, Convert EXISTING Worksheet Data to XML? | Excel Discussion (Misc queries) | |||
Append the data given in diff sheets of an Excel File to one sheet | Excel Worksheet Functions | |||
Hyperlink in Excel 2000 can't open bookmarked Word 2000 file | Excel Discussion (Misc queries) | |||
Weekly Transaction Processing | Excel Worksheet Functions |