Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50123

VBA Macro Copy to next empty row, different sheet

$
0
0
Hey guys, so I made a macro to copy data from my data entry sheet to my database sheet:


Code:


Private Sub CommandButton1_Click()
       
    Application.ScreenUpdating = False
   
    Dim NextRow As Range
   
    Set NextRow = Sheet4.Cells(Cells.Rows.Count, 1).End(xlUp).Offset(1, 0)
   
    Sheet2.Range("d3,d5,d7,d9,d11,d13,d15,d17,d19,d21,d23,d25,d27,d29,d33,d35").Copy
   
    'copy to next page
    Sheets("September").Select
    Selection.PasteSpecial (xlValues), Transpose:=True


    Application.CutCopyMode = False
    Application.ScreenUpdating = True
     
    Me.Hide
   
End Sub


Private Sub CommandButton2_Click()
       
  Me.Hide
           


End Sub

The main to problems are that its not pasting in in the right collum and its not passing the next entry in the next free row.

Have attached a screenshot of the two sheets, at the sheet has some personal data, i won't be able to upload it.

http://i.imgur.com/qnuWr.png

http://i.imgur.com/hn4En.png
Hope someone can help me wrap my head round this, been searching all over the web all day !

Viewing all articles
Browse latest Browse all 50123

Trending Articles