I have a worksheet that allows a user to pastes data in and then paste it into a hidden sheet in the workbook that drives a pivot table. This is done by command button.
My code selects data in the range until the last row, then pastes it into the next row without data in it in the other worksheet. I am then trying to delete the data from the upload sheet once then has finished. Everything works beside the deletion of the data. Not sure whats wrong. I also tried to use 'Cut' instead of copy, but had the same result. SOme help would be appreciated.
Sub TestingPaste()
Application.ScreenUpdating = False
Dim lst As Long
Sheets("Upload Data").Range(Range("A2:N2"), Range("A2:N2").End(xlDown)).Copy
With Sheets("Test")
lst = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & lst).PasteSpecial xlPasteColumnWidths
.Range("A" & lst).PasteSpecial xlPasteValues
Sheets("Upload Data").Range(Range("A2:N2"), Range("A2:N2").End(xlDown)).Clear
End With
Application.ScreenUpdating = True
End Sub
Sheets("Upload Data" ...
line outside theWith Sheets("Test")
block?Sheets("Upload Data").Range(Sheets("Upload Data").Range("A2:N2"), Sheets("Upload Data").Range("A2:N2").End(xlDown)).Copy
andSheets("Upload Data").Range(Sheets("Upload Data").Range("A2:N2"), Sheets("Upload Data").Range("A2:N2").End(xlDown)).Clear