Hi Everyone,

First time posting here and I am really new to the world of Macros & VBA. For work in order to upload our budget file into an online database system. I had to create an upload template that would basically take our budget line item data (that is horizontal format) and rearrange that data into a vertical file. Being that our budget is compose of roughly 500 line items, I figure it might take the same amount of time for me to give a Macro vs. manually manipulating the data.

With the help of the forum and reading about 1 chapter from a VBA beginners book. I was able to create a macro that actually worked. I am wondering if someone wants to take a shot at this Macro. I am just curious how an expert in VBA would have wrote this macro. Here is the code (which I will save forever)....please do not critique this code I am sure their are lots of flaws with it (as this was my first code ever)....I would just like to compare it to how any expert would have wrote. This experience has open my eyes to programming in excel and I want to keep learning.

I am attaching a spreadsheet of the import file. Sheet "data" is our budget information and the Sheet "Importfile" is how the "data" needs to be formatted. This a real short version of the data that I was working with (again actual data was over 500 line items). Also the headers (row 1) on the "data" sheet is strictly for reference and the working version did not contain this header row.


PHP Code: 
Sub Budget_Upload()
'
Budget_Upload Macro
'
            
            
Range("A1000000").FormulaR1C1 = "=SUM(R[-" & MyLastRow + 999999 & "]C:R[-1]C)"

   Do Until Sheets("AB").Range("A1000000").Value = 0
   
   
   Sheets("AB").Select
   Range("A1000000").FormulaR1C1 = "=SUM(R[-" & MyLastRow + 999999 & "]C:R[-1]C)"
   Range("A1").Select
   Selection.End(xlDown).Select
   ActiveCell.Rows.EntireRow.Select
   Selection.Cut
   Sheets("AA").Select
   Range("A1000000").Select
   Selection.End(xlUp).Select
   ActiveCell.Offset(1, 0).EntireRow.Select
   ActiveSheet.Paste
   ActiveCell.Offset(0, 5).Select
   Range(Selection, Selection.End(xlToRight)).Select
   Selection.Cut
   ActiveCell.Offset(0, 2).Select
   ActiveSheet.Paste
   Range(Selection, Selection.End(xlToRight)).Select
   Selection.Copy
   ActiveCell.Offset(0, -1).Select
   Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
   ActiveCell.Offset(0, -1).Select
   Selection.End(xlUp).Select
   ActiveCell.Offset(1, 0).Select
   
   ActiveCell.Offset(0, 0) = 1
   ActiveCell.Offset(1, 0) = 2
   ActiveCell.Offset(2, 0) = 3
   ActiveCell.Offset(3, 0) = 4
   ActiveCell.Offset(4, 0) = 5
   ActiveCell.Offset(5, 0) = 6
   ActiveCell.Offset(6, 0) = 7
   ActiveCell.Offset(7, 0) = 8
   ActiveCell.Offset(8, 0) = 9
   ActiveCell.Offset(9, 0) = 10
   ActiveCell.Offset(10, 0) = 11
   ActiveCell.Offset(11, 0) = 12
   
   ActiveCell.Offset(0, -1).Select
   
 Selection.End(xlToLeft).Select
    ActiveCell.Range("A1:E1").Select
    Selection.Copy
    ActiveCell.Range("A1:E12").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
   
    
   
   
   
   Sheets("AB").Select
   
    
    Loop
    
    
End Sub 


Thanks,
Ricardo Budget Import File (Excel Community).xlsm