Copy columns one below another
Solved/Closed
sun_dands
-
May 11, 2010 at 11:36 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 13, 2010 at 08:19 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 13, 2010 at 08:19 AM
Related:
- Auto serial number in excel based on another column
- Grand theft auto v free download no verification for pc - Download - Action and adventure
- How to stop auto refresh in facebook app - Guide
- Number to words in excel - Guide
- Grand theft auto iv download apk for pc - Download - Action and adventure
- How to set auto redial on android - Guide
2 responses
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 12, 2010 at 04:04 PM
May 12, 2010 at 04:04 PM
Try this. It presumes that you want to copy col 1-2 all the time. At copy of columns down should start at column 4
Sub CopyPasteSpecial() Dim lMaxRows As Long Dim iMaxCols As Integer Dim iCol As Integer Dim iStartAtCol As Integer Dim RangeToCopy As Range Dim lNextAtRow As Long iMaxCols = Cells(1, Columns.Count).End(xlToLeft).Column lMaxRows = Cells(Rows.Count, "A").End(xlUp).Row iStartAtCol = 4 Set RangeToCopy = Range(Cells(2, 1), Cells(lMaxRows, iStartAtCol - 2)) lNextAtRow = lMaxRows + 1 For iCol = iStartAtCol To iMaxCols RangeToCopy.Copy Cells(lNextAtRow, "A").Select ActiveSheet.Paste Range(Cells(2, iCol), Cells(lMaxRows, iCol)).Copy Range(Cells(lNextAtRow, iStartAtCol - 1), Cells(lNextAtRow + lMaxRows - 2, iStartAtCol - 1)).PasteSpecial lNextAtRow = lNextAtRow + lMaxRows - 1 Next iCol Range(Cells(1, iStartAtCol), Cells(lMaxRows, iMaxCols)).Delete Set RangeToCopy = Nothing End Sub
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 11, 2010 at 11:44 AM
May 11, 2010 at 11:44 AM
what you mean by "black data"
Are you looking simply to copy all columns under column A?
Are you looking simply to copy all columns under column A?
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 11, 2010 at 03:21 PM
May 11, 2010 at 03:21 PM
Could you please upload a sample file with sample data etc on some shared site like https://authentification.site and post back here the link to allow better understanding of how it is now and how you foresee.
https://authentification.site/files/22393996/eg_for_col_transpose.xlsx
i have given a small eg. the actual data would have 25 to 30 columns and more than 5000 rows
i have given a small eg. the actual data would have 25 to 30 columns and more than 5000 rows
May 13, 2010 at 07:46 AM
May 13, 2010 at 08:19 AM
Cheers