I need to copy a cell range into the next blank column in a separate sheet, every time the forms buttons for the macro is clicked.
Here's the code. The problem is it copies to the next blank row, and I need the next blank column. I have tried editing the line* in various ways and end up with errors, or no effect (e.g. replacing "Rows" with "Columns").
- Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
If found the base for the 'copy to next blank row VBA' here at SO, at the following link: Copy and Paste a set range in the next empty row
Thanks for any help, I'm stuck currently.
Sub TestCopyToDB()
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("sheet1")
Set pasteSheet = Worksheets("sheet2")
copySheet.Range("M1:M15").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub