Convert Monthly data into unique rows

F

Flamikey

Is there an add in out there to covert monthly data into unique record
to create a flat file in order to upload to a database? Example woul
be to convert a table that has in row one the following headers: Par
number in Col A, Customer in Col B, and Col C- Col O would be Jan
Dec. Going down the rows in Col C - Col O would be a forecasted qty.
I would like a quick way to flip this data into 4 columns, Part#
Customer, Month and Quantity. Thanks
 
D

Dave Peterson

C:0 is 13 columns???

How about C:N

Option Explicit
Sub testme()
'Is there an add in out there to covert monthly data into unique records
'to create a flat file in order to upload to a database? Example would
'be to convert a table that has in row one the following headers: Part
'number in Col A, Customer in Col B, and Col C- Col O would be Jan -
'Dec. Going down the rows in Col C - Col O would be a forecasted qty.
'I would like a quick way to flip this data into 4 columns, Part#,
'Customer , Month And Quantity.Thanks!

Dim wks As Worksheet
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long

Dim rngToCopy As Range

Set wks = Worksheets("sheet1")
With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

.Range("c:d").Insert

For iRow = LastRow To FirstRow Step -1
.Rows(iRow + 1).Resize(11).Insert
.Cells(iRow, "E").Resize(1, 12).Copy
.Cells(iRow, "D").PasteSpecial Transpose:=True
.Cells(iRow + 1, "A").Resize(11, 2).Value _
= .Cells(iRow, "A").Resize(1, 2).Value

With .Cells(iRow, "C").Resize(12)
.Formula = "=date(2004,row(a1),1)"
.Value = .Value
.NumberFormat = "mm/dd/yyyy"
End With
Next iRow

.Range("E:p").Clear
End With

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Save your workbook first--or close the workbook without saving--if the macro
doesn't work the way you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top