Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hello everybody
I have a little problem, I have a table in my excel worksheet, like this for example: 1 2 3 4 5 6 7 8 where the number of rows and columns can vary. I would like to transform this table in one column, like this: 1 5 2 6 3 7 4 8 Can anybody help me? Do I need a macro for this? Thanks a lot bernie |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe something like:
Option Explicit Sub testme() Dim iCol As Long Dim LastCol As Long Dim DestCell As Range Dim CurWks As Worksheet Dim NewWks As Worksheet Set CurWks = Worksheets("sheet1") Set NewWks = Worksheets.Add With CurWks LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column For iCol = 1 To LastCol With NewWks Set DestCell = .Cells(.Rows.Count, "A").End(xlUp) If IsEmpty(DestCell.Value) Then 'do nothing Else Set DestCell = DestCell.Offset(1, 0) End If End With .Range(.Cells(1, iCol), .Cells(.Rows.Count, iCol).End(xlUp)).Copy _ Destination:=DestCell Next iCol End With End Sub bernieb wrote: hello everybody I have a little problem, I have a table in my excel worksheet, like this for example: 1 2 3 4 5 6 7 8 where the number of rows and columns can vary. I would like to transform this table in one column, like this: 1 5 2 6 3 7 4 8 Can anybody help me? Do I need a macro for this? Thanks a lot bernie -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
divide column(x) by column(y) to give column(x/y) in excel? | New Users to Excel | |||
Referencing date column A & time column B to get info from column | Excel Discussion (Misc queries) | |||
Return text in Column A if Column B and Column K match | Excel Worksheet Functions | |||
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look | Excel Discussion (Misc queries) | |||
Crosstable to list | Excel Discussion (Misc queries) |