ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populate columns in one column one after one (https://www.excelbanter.com/excel-programming/338171-populate-columns-one-column-one-after-one.html)

ilyaskazi[_64_]

Populate columns in one column one after one
 

In selection.range, multiple columns are selected.

Upon execution, I need this all columns to be populated in one colum
one after one.

For example please see attached file.
FYI, Selection area= Green color cell, Output area=Yellow color cel

+-------------------------------------------------------------------
|Filename: Col-2-Row.zip
|Download: http://www.excelforum.com/attachment.php?postid=3734
+-------------------------------------------------------------------

--
ilyaskaz
-----------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396
View this thread: http://www.excelforum.com/showthread.php?threadid=39858


Bernie Deitrick

Populate columns in one column one after one
 
ilyaskazi,

Explain your needs with words - very few people will open your file.

HTH,
Bernie
MS Excel MVP


"ilyaskazi" wrote in message
...

In selection.range, multiple columns are selected.

Upon execution, I need this all columns to be populated in one column
one after one.

For example please see attached file.
FYI, Selection area= Green color cell, Output area=Yellow color cell


+-------------------------------------------------------------------+
|Filename: Col-2-Row.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3734 |
+-------------------------------------------------------------------+

--
ilyaskazi
------------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...o&userid=23969
View this thread: http://www.excelforum.com/showthread...hreadid=398583




ilyaskazi[_65_]

Populate columns in one column one after one
 

The only thing i need is to populate all the data of selected multipl
columns in single one column.
Data of column-C, D, E if selected, then populate its data in column-
with first column-C, D and then E.

Kindly requesting you all to see picture file attached, if possible.
m unable to explain more on this issue with words

+-------------------------------------------------------------------
|Filename: Col-2-Row.JPG
|Download: http://www.excelforum.com/attachment.php?postid=3742
+-------------------------------------------------------------------

--
ilyaskaz
-----------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396
View this thread: http://www.excelforum.com/showthread.php?threadid=39858


T-容x[_12_]

Populate columns in one column one after one
 

Maybe you'll get some ideas from this:

Sub CopyColumnByColumn()
'You should change [ActiveSheet.Range("C1:F7")] to you
selected range
Dim NumColumns As Integer
NumColumns
ActiveSheet.Range("C1:F7").Columns.Count

Dim NumRows As Long
NumRows = ActiveSheet.Range("C1:F7").Rows.Count

Dim ColIndex As Integer
Dim RowIndex As Long
RowIndex = 1 'start at first row

For ColIndex = 1 To NumColumns
ActiveSheet.Range("C1:F7").Columns(ColIndex).Cop
Cells(RowIndex, 1)
RowIndex = RowIndex + NumRows
Next ColIndex
End Sub

hope this helps... :)

ilyaskazi Wrote:
The only thing i need is to populate all the data of selected multipl
columns in single one column.
Data of column-C, D, E if selected, then populate its data in column-
with first column-C, D and then E.

Kindly requesting you all to see picture file attached, if possible.
m unable to explain more on this issue with words


--
T-容
-----------------------------------------------------------------------
T-容x's Profile: http://www.excelforum.com/member.php...fo&userid=2657
View this thread: http://www.excelforum.com/showthread.php?threadid=39858


ilyaskazi[_66_]

Populate columns in one column one after one
 

Excellent !!!

It is working exactly as wanted for copying column by column

Thankyou T-容x...

I was trying hard to apply same with copying row by row but fail to do
so.
Can u help me again plz..


--
ilyaskazi
------------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...o&userid=23969
View this thread: http://www.excelforum.com/showthread...hreadid=398583


T-容x[_51_]

Populate columns in one column one after one
 

Try the following:


Code
-------------------
'copies the contents of a selection, column by column, to column 'A'
'starting at row 1
Sub CopyColumnByColumn()
Dim SelectedTarget As Range
Dim NumColumns As Integer
Dim NumRows As Long
Dim ColIndex As Integer
Dim RowIndex As Long
Dim ColLocation As Integer

Set SelectedTarget = Selection
NumColumns = SelectedTarget.Columns.Count
NumRows = SelectedTarget.Rows.Count
RowIndex = 1 'start at first row
ColLocation = 1 'copy to column 'A'

For ColIndex = 1 To NumColumns
SelectedTarget.Columns(ColIndex).Copy Cells(RowIndex, ColLocation)
RowIndex = RowIndex + NumRows
Next ColIndex
End Sub

'copies the contents of a selection, row by row, to row 1
'starting at column 'A'
Sub CopyRowByRow()
Dim SelectedTarget As Range
Dim NumColumns As Integer
Dim NumRows As Long
Dim ColIndex As Integer
Dim RowIndex As Long
Dim RowLocation As Long

Set SelectedTarget = Selection
NumColumns = SelectedTarget.Columns.Count
NumRows = SelectedTarget.Rows.Count
ColIndex = 1 'start at first column
RowLocation = 1 'copy to row 1

For RowIndex = 1 To NumRows
SelectedTarget.Rows(RowIndex).Copy Cells(RowLocation, ColIndex)
ColIndex = ColIndex + NumColumns
Next RowIndex
End Sub

'copies the contents of a selection, row by row, to column 'A'
'starting at row 1
Sub CopyRowByRowToColumn()
Dim SelectedTarget As Range
Dim NumColumns As Integer
Dim NumRows As Long
Dim ColIndex As Integer
Dim RowIndex As Long
Dim ColLocation As Integer
Dim CurrentRow As Long

Set SelectedTarget = Selection
NumColumns = SelectedTarget.Columns.Count
NumRows = SelectedTarget.Rows.Count
ColLocation = 1 'copy to column 'A'
CurrentRow = 1 'start at row 1

For RowIndex = 1 To NumRows
For ColIndex = 1 To NumColumns
Cells(CurrentRow, ColLocation).Value = SelectedTarget.Cells(RowIndex, ColIndex).Value
CurrentRow = CurrentRow + 1
Next ColIndex
Next RowIndex
End Su
-------------------


To use, run these codes against a selection, i.e., select some cell
and run the code... :)

ilyaskazi Wrote:
Excellent !!!

It is working exactly as wanted for copying column by column

Thankyou T-容x...

I was trying hard to apply same with copying row by row but fail to d
so.
Can u help me again plz.


--
T-容
-----------------------------------------------------------------------
T-容x's Profile: http://www.excelforum.com/member.php...fo&userid=2657
View this thread: http://www.excelforum.com/showthread.php?threadid=39858


ilyaskazi[_67_]

Populate columns in one column one after one
 

Great Job Mr T-容x.

Thankyou for your time and help

--
ilyaskaz
-----------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396
View this thread: http://www.excelforum.com/showthread.php?threadid=39858



All times are GMT +1. The time now is 06:15 AM.

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