Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Amend Transfer code

Posted on 2014-07-30
6
Medium Priority
?
100 Views
Last Modified: 2014-07-31
Hi,

I need an amendment to the following piece of code

The copy is a regular paste, i need a paste special

Many thanks

Sub macro()
Dim arrData As Variant
Dim arrTransfer As Variant
LastTransferRow = Sheets("Change Summary").Range("A" & Rows.Count).End(xlUp).Row
arrData = Join(WorksheetFunction.Index(Sheets("Add Delete Team Members").Range("N15:W17").Value, 1, 0), ";")
arrTransfer = Join(WorksheetFunction.Index(Sheets("Change Summary").Range("N" & LastTransferRow & ":A" & LastTransferRow).Value, 1, 0), ";")
If arrData = arrTransfer Then
    Res = MsgBox("This is the same data, are you sure you want to send", vbYesNo)
    If Res = vbYes Then
        Sheets("Add Delete Team Members").Range("N15:W17").Copy Sheets("Change Summary").Range("A" & LastTransferRow + 1)
    Else
        Exit Sub
    End If
Else
    Sheets("Add Delete Team Members").Range("N15:W17").Copy Sheets("Change Summary").Range("A" & LastTransferRow + 1)
End If
End Sub

Open in new window

0
Comment
Question by:Seamus2626
  • 3
  • 3
6 Comments
 
LVL 13

Expert Comment

by:duncanb7
ID: 40229377
You can try this,

Sheets("Change Summary").Range("A" & LastTransferRow + 1).PasteSpecial   xlPasteValues  

OR

Sheets("Change Summary").Range("A" & LastTransferRow + 1).PasteSpecial    xlPasteFormats
0
 

Author Comment

by:Seamus2626
ID: 40229402
Hi Duncan,

I dropped that in and got the error message

"Invalid use of property" on line xlPasteValues

Sub New_Staff()
Dim arrData As Variant
Dim arrTransfer As Variant
LastTransferRow = Sheets("Change Summary").Range("A" & Rows.Count).End(xlUp).Row
arrData = Join(WorksheetFunction.Index(Sheets("Add Delete Team Members").Range("N15:W17").Value, 1, 0), ";")
arrTransfer = Join(WorksheetFunction.Index(Sheets("Change Summary").Range("N" & LastTransferRow & ":A" & LastTransferRow).Value, 1, 0), ";")
If arrData = arrTransfer Then
    Res = MsgBox("This is the same data, are you sure you want to send", vbYesNo)
    If Res = vbYes Then
        Sheets("Add Delete Team Members").Range("N15:W17").Copy Sheets("Change Summary").Range("A" & LastTransferRow + 1).PasteSpecial
        xlPasteValues


    Else
        Exit Sub
    End If
Else
    Sheets("Add Delete Team Members").Range("N15:W17").Copy Sheets("Change Summary").Range("A" & LastTransferRow + 1).PasteSpecial
    xlPasteValues
End If
End Sub

Open in new window

0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40229421
Could you  write your question in detail , what you want which sheet which range or cell to get pasteSpecial and what format for the paste you want ?

duncan
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Seamus2626
ID: 40229473
Okay,

So my code picks up range N15:W17 from tab "Add Delete Team Members" and pastes over to tab "Change Summary", it pastes to the next available row after the headings (A1:L1)

When it pastes, its pastes with formats, i do not want the formats, i only want the values

Thanks
0
 
LVL 13

Accepted Solution

by:
duncanb7 earned 2000 total points
ID: 40229485
You need to the put the range and sheet  you want with this PasteSpeical with values only

.PasteSpecial   xlPasteValues
0
 

Author Comment

by:Seamus2626
ID: 40229516
Thanks Duncan but It does not work on this code

Put that line into my code where you would put it and i will run

Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question