PDA

View Full Version : Rows to Column (Transpose) with one Heading



satish gubbi
01-20-2014, 07:05 AM
Hi,

Request your help in transposing the data (rows to column) with one common heading.

I have attached herewith the sample data and required result in the file.

kindly help me in this regard

Regards,
Satish Gubbi

Bob Phillips
01-20-2014, 10:46 AM
Public Sub RearrangeData()
Dim lastrow As Long
Dim i As Long

With ActiveSheet

lastrow = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = lastrow To 1 Step -4

.Cells(i - 2, "B").Value = .Cells(i - 2, "C").Value
.Cells(i - 2, "D").Value = .Cells(i, "C").Value
.Cells(i - 2, "C").Value = .Cells(i - 1, "C").Value

.Rows(i - 1).Resize(3).Delete
Next i

.Range("B1:D1") = Array("VAT 14.5%", "Net Product", "Sales")

lastrow = .Cells(.Rows.Count, "B").End(xlUp).Row
.Range("B2").Resize(lastrow - 1).NumberFormat = "#,##0.00"
End With
End Sub

satish gubbi
01-20-2014, 09:26 PM
Thank you very much XLD, I will check the code and I will post the status.