The easiest way is going to be with a macro. Here's the code:
Option Explicit
Sub NewTable()
'JBeaucaire (9/12/2009)
Dim LR As Long, i As Long, ws As Worksheet
If ActiveSheet.Name = "NewTable" Then
MsgBox "Please start the macro from the sheet with the new data."
Exit Sub
End If
Set ws = ActiveSheet
If Not Evaluate("ISREF(NewTable!A1)") Then 'If sheet doesn't exist, create it
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "NewTable"
Range("A1") = "Style"
Range("B1") = "Size"
Range("C1") = "Status"
With Range("A1:C1")
.Font.Bold = True
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeBottom).LineStyle = xlContinuous
End With
Range("A2").Select
ActiveWindow.FreezePanes = True
ws.Activate
Else
Sheets("NewTable").Range("A2:AA" & Rows.Count).Clear
End If
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:A" & LR).Copy Sheets("NewTable").Range("A2")
Range("B2:B" & LR).Copy Sheets("NewTable").Range("C2")
Range("A2:A" & LR).Copy Sheets("NewTable").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Range("C2:C" & LR).Copy Sheets("NewTable").Range("C" & Rows.Count).End(xlUp).Offset(1, 0)
Range("A2:A" & LR).Copy Sheets("NewTable").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Range("D2:D" & LR).Copy Sheets("NewTable").Range("C" & Rows.Count).End(xlUp).Offset(1, 0)
Range("A2:A" & LR).Copy Sheets("NewTable").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Range("E2:E" & LR).Copy Sheets("NewTable").Range("C" & Rows.Count).End(xlUp).Offset(1, 0)
Sheets("NewTable").Activate
LR = Range("A" & Rows.Count).End(xlUp).Row
ws.Range("B1:E1").Copy
Range("B2:B" & LR).PasteSpecial Paste:=xlPasteAll, Transpose:=True
Application.CutCopyMode = False
Columns("A:C").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End Sub
You'll need to insert this permanently into a workbook.
How to use the macro:
1. Open up your workbook
2. Get into VB Editor (Press Alt+F11)
3. Insert a new module (Insert > Module)
4. Copy and Paste in your code (given above)
5. Get out of VBA (Press Alt+Q)
6. Save your sheet
The macro is installed and ready to use.
First, bring up your CSV file so that it is onscreen, then press Alt-F8 and select this macro from the list.
It will create a worksheet called NewTable and put the data in the format you want. You can move the resulting sheet elsewhere or to another book, up to you.
Bookmarks