nirvehex
04-02-2016, 01:46 PM
Hello,
I seem to not be able to get this piece of code to correctly paste values.
Sub Recommendation()
Sheets("Recommendation").Select
Dim lr As Long
lr = Cells(Rows.Count, 3).End(xlUp).Row
Application.ScreenUpdating = False
Range("C2:I5").Copy Cells(lr + 1, 3).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range(Cells(lr + 1, 1), Cells(lr + 4, 1)).Value = Sheets("Data Table").Cells(Rows.Count, 1).End(xlUp).Value
Range(Cells(lr - 3, 1), Cells(lr, 14)).Copy
Range(Cells(lr + 1, 1), Cells(lr + 4, 14)).PasteSpecial Paste:=xlPasteFormats
Range(Cells(lr - 3, 10), Cells(lr, 10)).Copy Cells(lr + 1, 10)
Cells(lr - 3, 2).Copy Cells(lr + 1, 2)
Range(Cells(lr - 3, 11), Cells(lr, 11)).Copy Cells(lr + 1, 11)
Application.ScreenUpdating = True
End Sub
It's throwing an error on this line:
Range("C2:I5").Copy Cells(lr + 1, 3).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Any idea how to write this correctly?
Thanks!
I seem to not be able to get this piece of code to correctly paste values.
Sub Recommendation()
Sheets("Recommendation").Select
Dim lr As Long
lr = Cells(Rows.Count, 3).End(xlUp).Row
Application.ScreenUpdating = False
Range("C2:I5").Copy Cells(lr + 1, 3).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range(Cells(lr + 1, 1), Cells(lr + 4, 1)).Value = Sheets("Data Table").Cells(Rows.Count, 1).End(xlUp).Value
Range(Cells(lr - 3, 1), Cells(lr, 14)).Copy
Range(Cells(lr + 1, 1), Cells(lr + 4, 14)).PasteSpecial Paste:=xlPasteFormats
Range(Cells(lr - 3, 10), Cells(lr, 10)).Copy Cells(lr + 1, 10)
Cells(lr - 3, 2).Copy Cells(lr + 1, 2)
Range(Cells(lr - 3, 11), Cells(lr, 11)).Copy Cells(lr + 1, 11)
Application.ScreenUpdating = True
End Sub
It's throwing an error on this line:
Range("C2:I5").Copy Cells(lr + 1, 3).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Any idea how to write this correctly?
Thanks!