+ Reply to Thread
Results 1 to 3 of 3

Help: "PasteSpecial method of Range class failed"

  1. #1
    Registered User
    Join Date
    06-01-2004
    Posts
    6

    Help: "PasteSpecial method of Range class failed"

    This is a very simple function and code but I can't figure out why there's an error.
    Runnings this in Excel 2003 SP1.

    Code below:
    `````````````````````````````````````
    Sub DataTest()

    Dim TempBook As String

    TempBook = "F:\VCS Data Name.xls"

    Workbooks.Open (TempBook)
    Worksheets("Name").Activate
    Range("B1") = "DataTest 05 01-12"

    Workbooks("VCS DATA R2000 05 01-03.xls").Activate
    Worksheets("Percentile Grouping").Activate
    With Range("B8")
    Range(.Offset(1, 0), .Offset(1, 0).End(xlDown)).Copy
    End With

    Application.CutCopyMode = False
    Application.DisplayAlerts = False

    Workbooks("VCS Data Name.xls").Activate
    Worksheets("VCS R2000").Activate
    Range("B4").Select
    Selection.PasteSpecial Paste:=xlPasteValues
    Workbooks("VCS Data Name.xls").Close savechanges:=True
    Application.DisplayAlerts = True


    End Sub

    `````````````````````````````````````
    The error occurs on the Selection.PasteSpecial line. "PasteSpecial method of Range class failed." The data that is copied is not too large. Its one column by about 1300 rows and it can be done manually using the macro recorder without an error. When I use this code, however, it blows up.

    Any assistance you can provide would be greatly appreciated.

    -PropKid

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845
    PropKid,

    Just a guess but you did a:

    Range(.Offset(1, 0), .Offset(1, 0).End(xlDown)).Copy

    Then you set:

    Application.CutCopyMode = False

    could be a conflict. You copied the it looks like you turnd it off.

    Try removing Application.CutCopyMode = False

    to see that works.

    Charles

  3. #3
    Registered User
    Join Date
    06-01-2004
    Posts
    6
    Charles,

    That's EXACTLY what the problem was. Many thanks for your assistance!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1