ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Convert Columns to Rows (https://www.excelbanter.com/excel-discussion-misc-queries/219640-re-convert-columns-rows.html)

Chris Bode via OfficeKB.com

Convert Columns to Rows
 
Please follow following steps
1.Right click on the toolbar click Control Box
2.From the control box that appears on your screen, select a command button
and draw it to your sheet
3.Double click the command button and write following codes in code window
Now paste following codes
#
Private Sub CommandButton1_Click()
Dim row As Integer, col As Integer

row = 1
col = 1


Dim rowinsheet2 As Integer, colinsheet2 As Integer

rowinsheet2 = 1
For col = 1 To 3
row = 1
colinsheet2 = 1

While Sheet1.Cells(row, col).Value < ""


Sheet2.Cells(rowinsheet2, colinsheet2).Value = Sheet1.Cells(row,
col).Value

colinsheet2 = colinsheet2 + 1

row = row + 1

Wend
rowinsheet2 = rowinsheet2 + 1
Next
End Sub
#

Have a nice time€¦.


Chris
------
Convert your Excel spreadsheet into an online calculator.
http://www.spreadsheetconverter.com

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200902/1



All times are GMT +1. The time now is 02:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com