by J-Walk (not verified) on Wed, 2007-02-28 16:26

In XL 2007, you can add the old PivotTable and Chart Report Wizard to your Quick Access Toolbar. In the Customize tab, look in the "not available in the ribbon" section.

Better yet, use this code. It's a much more direct way of accomplishing the same thing (the line breaks are probably messed up).

-John

Sub MakeTable()
Dim OutputRng As Range
Dim InputRng As Range
Dim out_row As Long, out_col As Long
Dim in_col As Long, in_row As Long

Set InputRng = ActiveCell.CurrentRegion
Set OutputRng = Application.InputBox(prompt:="Click the upper left cell for the output", Type:=8)

OutputRng.Range("A1:C1") = Array("Col1", "Col2", "Col3")
out_row = 2
out_col = 2
For in_row = 2 To (InputRng.Rows.Count - 1) * (InputRng.Columns.Count - 1) + 1
For in_col = 1 To 3
If in_col = 1 Then OutputRng.Cells(in_row, in_col) = InputRng.Cells(out_row, 1)
If in_col = 2 Then OutputRng.Cells(in_row, in_col) = InputRng.Cells(1, out_col)
If in_col = 3 Then OutputRng.Cells(in_row, in_col) = InputRng.Cells(out_row, out_col)
Next in_col
out_col = out_col + 1
If out_col = InputRng.Columns.Count + 1 Then
out_col = 2
out_row = out_row + 1
End If
Next in_row

End Sub

Reply

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
More information about formatting options