how to change data from horizontal to be vertical (Excel 2007)

  • Thread starter Suwat Upathambhakul (Thailand)
  • Start date
S

Suwat Upathambhakul (Thailand)

Bill of materials for many Finished goods showing Raw materials in
horizontal, I would like to change Raw Materials from horizontal to vertical.

Kindly advised how to do that.

thanks and best regards,
suwat upathambhakul
 
S

Sheeloo

Copy the data you want...
Select a cell outside the copied area
Right click, choose Paste Special and select Transpose...
 
S

Suwat Upathambhakul (Thailand)

Dear Sheeloo

thank you so much, but we have many many finished goods, do you know how to
attach file into this forum ?

thank you so much,
(e-mail address removed)
 
S

Sheeloo

NO.

I upload to a site like wikisend.com and paste the link...

You can mail it to me...
 
F

Fred Smith

This forum does not accept attachments, because of the risk of viruses.

All you need to do is explain your problem clearly, and you will get a
quick, accurate response. You can start with explaining why Sheeloo's
response didn't help you. It looked like it accurately answered the question
to me.

If you insist, you can store your file at a third-party hosting site, and
post the link here, but don't be surprised if there aren't any takers.

Regards,
Fred.


"Suwat Upathambhakul (Thailand)"
 
S

Suwat Upathambhakul (Thailand)

Dear Sheeloo

your advise is helpful, I sent my file to wikiend.com as per your advice,

thanks again,
rgds, suwat u.
 
S

Suwat Upathambhakul (Thailand)

Dear Fred smith

thank you so much, sorry for my mistake, this is the my first post, I think
I should better create a new post for easy understanding.

rgds, suwat u.
 
S

Sheeloo

Here is the macro for the benefit of other readers...

Sub Transpose()
Dim lastRow, lastCol As Long
Dim srcSheet As String
Dim destSheet As String
Dim i, j, k As Long
Dim RM() As String
Application.ScreenUpdating = False
srcSheet = "BOM (Bill of materials)"
destSheet = ActiveSheet.Name
Worksheets(srcSheet).Activate
With Worksheets(srcSheet)
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With
ReDim RM(lastCol)
For j = 3 To lastCol
RM(j) = Worksheets(srcSheet).Cells(1, j)
Next
k = 2
For i = 2 To lastRow
Sheets(destSheet).Cells(k, 1) = Worksheets(srcSheet).Cells(i, 1)
Sheets(destSheet).Cells(k, 2) = Worksheets(srcSheet).Cells(i, 2)
For j = 3 To lastCol
If (Worksheets(srcSheet).Cells(i, j) <> "") Then
Sheets(destSheet).Cells(k, 3) = RM(j)
Sheets(destSheet).Cells(k, 4) = Worksheets(srcSheet).Cells(i, j)
k = k + 1
End If
Next j
Next i
Worksheets(destSheet).Activate
Application.ScreenUpdating = True
End Sub

Sub clearCells()
With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With
Range(Cells(2, 1), Cells(lastRow, lastCol)).clear
End Sub
 

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