Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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-®e ----------------------------------------------------------------------- T-®ex's Profile: http://www.excelforum.com/member.php...fo&userid=2657 View this thread: http://www.excelforum.com/showthread.php?threadid=39858 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populate columns in one column one after one
Excellent !!! It is working exactly as wanted for copying column by column Thankyou T-®ex... 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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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-®ex... I was trying hard to apply same with copying row by row but fail to d so. Can u help me again plz. -- T-®e ----------------------------------------------------------------------- T-®ex's Profile: http://www.excelforum.com/member.php...fo&userid=2657 View this thread: http://www.excelforum.com/showthread.php?threadid=39858 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populate columns in one column one after one
Great Job Mr T-®ex. 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I get criteria from columns to populate down? | Excel Discussion (Misc queries) | |||
Vlookup? populate 3 columns of data when match a common value, | Excel Worksheet Functions | |||
Populate multiple columns | Excel Worksheet Functions | |||
Populate a column by extracting unique values from another column? | Excel Worksheet Functions | |||
Populate 2-column ListBox with 2 non-contiguous columns | Excel Programming |