BPW
New Member
- Joined
- Mar 7, 2013
- Messages
- 31
- Office Version
- 365
- Platform
- Windows
I was wondering if anyone would be able to help me get un-stuck with a wrinkle in my macro. What I'm trying to do is copy a variable range on WS1 and paste values to another sheet at the next empty row below. The idea is to enter data in WS1 and click a button that will copy that data and paste (values) into WS2, appending to any previously pasted data.
My VBA is below. Is there any advice on where I can modify the existing code to add that appending ability? Or is this code poor approach and I should go about it another way?
Please let me know if additional context or information is needed.
Thanks in advance!
Barry
My VBA is below. Is there any advice on where I can modify the existing code to add that appending ability? Or is this code poor approach and I should go about it another way?
Please let me know if additional context or information is needed.
Thanks in advance!
Barry
VBA Code:
Sub CSV_Creation()
Dim ws1 As Worksheet, ws2 As Worksheet
Set ws1 = Worksheets("CSV")
Set ws2 = Worksheets("CSV EXPORT")
Dim Ary As Variant
Dim LastRow As Long
'First SKU to CSV Export tab from CSV
LastRow = ws1.Cells(Rows.Count, "A").End(xlUp).Row
Ary = Application.Unique(ws1.Range("A1:C" & LastRow).Value)
ws2.Range("A1:C" & LastRow).Resize(UBound(Ary)).Value = Ary
End Sub