Seamus2626
asked on
Paste special failing (VBA)
If Range("Y15") = 1 Then
Sheets("Add Delete Team Members").Range("N15:W15") .Copy Destination:=Sheets("Chang e Summary").Range("A" & LastTransferRow + 1) PasteSpecial Paste:=xlPasteValues
This line of code has incorrect syntax, can someone suggest new syntax or a new line of code to transfer the range from one sheet to another using paste special
Thanks
Sheets("Add Delete Team Members").Range("N15:W15")
This line of code has incorrect syntax, can someone suggest new syntax or a new line of code to transfer the range from one sheet to another using paste special
Thanks
ASKER
Hi Duncan,
Below is my sub, with your line added, im getting the error message
"Unable to get the pastespecial property of the range class"
Thanks
Below is my sub, with your line added, im getting the error message
"Unable to get the pastespecial property of the range class"
Thanks
Sub TransferNewData()
LastTransferRow = Sheets("Change Summary").Range("A" & Rows.Count).End(xlUp).Row
If Range("Y15") = 1 Then
Sheets("Add Delete Team Members").Range("N15:W15").Copy Destination:=Sheets("Change Summary").Range("A" & LastTransferRow + 1).PasteSpecial(xlPasteValues)
Else
End If
If Range("Y16") = 1 Then
Sheets("Add Delete Team Members").Range("N16:W16").Copy Destination:=Sheets("Change Summary").Range("A" & LastTransferRow + 1).PasteSpecial(xlPasteValues)
Else
End If
If Range("Y17") = 1 Then
Sheets("Add Delete Team Members").Range("N17:W17").Copy Destination:=Sheets("Change Summary").Range("A" & LastTransferRow + 1).PasteSpecial(xlPasteValues)
Else
End If
End Sub
Could you use two lines instead of one line ?
for example,
.copy
.PasteSpecial paste:=xlpastevalues
If so, it will be easier
Duncan
for example,
.copy
.PasteSpecial paste:=xlpastevalues
If so, it will be easier
Duncan
ASKER
Ya, i dont mind, if you could plug it in and it works, id be very happy!!
Thanks
Thanks
Y15,Y16,Y17 , is it on Change Summary sheet,right ?
Try this
Duncan
Try this
Duncan
Sub TransferNewData()
Sheets("Change Summary").Select
lastTransferRow = Sheets("Change Summary").Range("A" & Rows.Count).End(xlUp).Row
If Sheets("Change Summary").Range("Y15") = 1 Then
Sheets("Add Delete Team Members").Range("N15:W15").Copy
Sheets("Change Summary").Range("A" & lastTransferRow).PasteSpecial Paste:=xlPasteValues
Else
End If
If Sheets("Change Summary").Range("Y16") = 1 Then
Sheets("Add Delete Team Members").Range("N16:W16").Copy
Sheets("Change Summary").Range("A" & lastTransferRow + 1).PasteSpecial Paste:=xlPasteValues
Else
End If
If Sheets("Change Summary").Range("Y17") = 1 Then
Sheets("Add Delete Team Members").Range("N17:W17").Copy
Sheets("Change Summary").Range("A" & lastTransferRow + 1).PasteSpecial Paste:=xlPasteValues
Else
End If
'Sheets("Change Summary").Range("Y" & lastTransferRow).Select
End Sub
ASKER
Y15 etc is on the "add delete team members" sheet
ASKER
Il amend and try, thanks!
typing error at on around Y15 ,lastTransferRow , it should be lastTransferRow+1 om my code
Duncan
Duncan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect, thanks for your help Duncan!
Thanks for your points
Have a nice day
Duncan
Have a nice day
Duncan
Try this,
Open in new window
Duncan