ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Macros - Grid Converted to Vertical Listing (https://www.excelbanter.com/excel-programming/356744-excel-macros-grid-converted-vertical-listing.html)

Jason Heider

Excel Macros - Grid Converted to Vertical Listing
 
I have a file (Cash Wksht) which has the dates along the left hand side and
the name of each account along the top. The values are entered in their
respective locations on the grid. I am looking to develop a listing in a
separate spreadsheet (Daily Values)which would have column A - Date, column B
- Amount and column C - Name. I have been able to copy the date multiple
times but have been mostly unsuccessful with the rest of the data. Attached
is the macros I have developed:

Sub Macro2()

' Macro recorded 3/21/2006 by Jason Heider
'
Dim i As Integer

' Setup Initial Cell Position
Sheets("Daily Values").Select
Range("A8").Select

Do

'Paste Dates
Sheets("Cash Wksht").Select
Range("A10:A40").Select
Selection.Copy
Sheets("Daily Values").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
Sheets("Cash Wksht").Select

' Paste Values

Range("B10:B40").Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=i).Activate
' ActiveCell.Offset(30, 0).Select
Selection.Copy
Sheets("Daily Values").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
Sheets("Cash Wksht").Select

' Paste Item Name
Range("B9").Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=i).Activate
Selection.Copy
Sheets("Daily Values").Select
ActiveSheet.Paste
Application.CutCopyMode = False

' Move To End of Last Pasted Group
Range("A8").Select
Selection.End(xlDown).Select
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate

' Index of 20 Columns
i = i + 1

Loop Until i 20

End Sub

Please let me know if you can be of assistance.
Thanks again.


All times are GMT +1. The time now is 04:36 AM.

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