I need to copy 20 columns of data using complete columns length excluding header into worksheet in same workbook and place the copy data uniquely in columns under last used row but only paste values I worked on the code below but don't know how to only paste values. I also noticed that the code recognized the last used row, but still went up one and overwrote the last used row. Can I add a paste values function to what I have or declare the copy or pste function as a value somewhere else
Sub CopyAX()
Dim x As Worksheet, y As Worksheet, LastRow&, yLastRow&
'Set x = Workbooks("Input.xlsb").Worksheets("Opportunity")'Use if in another workbook
Set x = ThisWorkbook.Worksheets("AX_Data")
Set y = ThisWorkbook.Worksheets("AR_Data_Work_Area")
'Dim PasteRow AS Long
'PasteRow = y.UsedRange.Rows(y.UsedRange.Rows.Count).Row + 1 ' Change yLastRow to PasteRow in all ranges
LastRow = x.Cells.SpecialCells(xlCellTypeLastCell).Row
yLastRow = y.Cells(y.Rows.Count, "A").End(xlUp).Row + 1
x.Range("AS2:AS" & LastRow).Copy y.Cells(yLastRow, "A").End(xlUp)
x.Range("AT2:AT" & LastRow).Copy y.Cells(yLastRow, "B").End(xlUp)
x.Range("B2:B" & LastRow).Copy y.Cells(yLastRow, "C").End(xlUp)
x.Range("AR2:AR" & LastRow).Copy y.Cells(yLastRow, "D").End(xlUp)
x.Range("AU2:AU" & LastRow).Copy y.Cells(yLastRow, "E").End(xlUp)
x.Range("BG2:BG" & LastRow).Copy y.Cells(yLastRow, "F").End(xlUp)
x.Range("BH2:BH" & LastRow).Copy y.Cells(yLastRow, "G").End(xlUp)
x.Range("BI2:BI" & LastRow).Copy y.Cells(yLastRow, "H").End(xlUp)
x.Range("BF2:BF" & LastRow).Copy y.Cells(yLastRow, "I").End(xlUp)
x.Range("C2:C" & LastRow).Copy y.Cells(yLastRow, "J").End(xlUp)
x.Range("G2:G" & LastRow).Copy y.Cells(yLastRow, "K").End(xlUp)
x.Range("D2:D" & LastRow).Copy y.Cells(yLastRow, "L").End(xlUp)
x.Range("R2:R" & LastRow).Copy y.Cells(yLastRow, "M").End(xlUp)
x.Range("J2:J" & LastRow).Copy y.Cells(yLastRow, "N").End(xlUp)
x.Range("AW2:AW" & LastRow).Copy y.Cells(yLastRow, "O").End(xlUp)
x.Range("AX2:AX" & LastRow).Copy y.Cells(yLastRow, "P").End(xlUp)
x.Range("AY2:AY" & LastRow).Copy y.Cells(yLastRow, "Q").End(xlUp)
x.Range("AZ2:AZ" & LastRow).Copy y.Cells(yLastRow, "R").End(xlUp)
x.Range("BA2:BA" & LastRow).Copy y.Cells(yLastRow, "S").End(xlUp)
x.Range("BB2:BB" & LastRow).Copy y.Cells(yLastRow, "T").End(xlUp)
Application.CutCopyMode = False
End Sub
Bookmarks