Solved

Amend Transfer code

Posted on 2014-07-30
6
94 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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 500 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

822 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