sort headings vertically ....

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
I have this data in one sheet with dates in 30-31 date rows and amount in columns. I am coping and pasting each row and column manually in a new sheet to get the desired result. It is taking me hours to complete this. If there is any other easier and faster way to do this, please share.

The count of number of cells in each column varies from date to date and may range up to 300 rows in some cases. I am trying to get the data, in a new worksheet, in such a way that I get the date in one column and the amounts in the adjoining column. The amounts in column A starting from cell A2 to A 12 need to be copied and pasted to column B in a new worksheet. In Column A of the new work sheet it should take the date from cell A1. Again, the amounts in column B starting from B2 to B4 need to be copied and pasted to column B of the new worksheet, below the next empty cell. Here, column B, in the new worksheet, it should take the date from cell B2 below the next empty cell and so on…..

For reference only, I have used the same worksheet for the query.
Query for copy data to next sheet in vertical oder.xlsx
ABCDEFG
101-01-202002-01-202003-01-2020DateAmount
212.5030.00836.3501-01-202012.50
3627.9092.50548.6001-01-2020627.90
41,470.00142.00313.1501-01-20201,470.00
5475.80661.9001-01-2020475.80
6623.650.5001-01-2020623.65
722.50108.5001-01-202022.50
86.0025,000.0001-01-20206.00
912.0001-01-202012.00
1018.0001-01-202018.00
1102-01-202030.00
1202-01-202092.50
1302-01-2020142.00
1403-01-2020836.35
1503-01-2020548.60
1603-01-2020313.15
1703-01-2020661.90
1803-01-20200.50
1903-01-2020108.50
2003-01-202025,000.00
21This is the DataFinal Result in new blank worksheet
22
workings
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
How about
VBA Code:
Sub Rajesh()
   Dim Cl As Range
   
   With Sheets("Workings")
      For Each Cl In .Range("A1", .Cells(1, Columns.Count).End(xlToLeft))
         With .Range(Cl.Offset(1), Cl.End(xlDown))
            .Copy Sheets("Sheet2").Range("B" & Rows.Count).End(xlUp).Offset(1)
            Cl.Copy Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(.Count)
         End With
      Next Cl
   End With
End Sub
 
Upvote 0
Solution
How about
VBA Code:
Sub Rajesh()
   Dim Cl As Range
  
   With Sheets("Workings")
      For Each Cl In .Range("A1", .Cells(1, Columns.Count).End(xlToLeft))
         With .Range(Cl.Offset(1), Cl.End(xlDown))
            .Copy Sheets("Sheet2").Range("B" & Rows.Count).End(xlUp).Offset(1)
            Cl.Copy Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(.Count)
         End With
      Next Cl
   End With
End Sub
Perfect.... Thank You Mr.Genius. This is one of those difficult codes to understand which I would like to understand someday.
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,062
Messages
6,122,925
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top