+ Reply to Thread
Results 1 to 3 of 3

Copy and Paste Runtime Error - Newbie, really struggling here!

  1. #1
    Registered User
    Join Date
    03-02-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    17

    Exclamation Copy and Paste Runtime Error - Newbie, really struggling here!

    Made this code...

    Trying to work out why I get "Method PasteSpecial of Object Range Failed" Runtime error 1004

    It gets as far as the pastespecial line.

    What I want the macro to do is very simple:
    -select data from the active cell down to the last cell in the column
    -cut that data
    -move 3 rows down, same column
    -paste the data
    -move 1 row down
    -repeat until the active cell is empty (it gets to the bottom of the data)

    PLEASE PLEASE PLEASE HELP

    Sub Macro2()
    '
    ' Macro2 Macro
    'Dim Start
    'Dim i As Integer

    ActiveCell.Name = "start"
    'Cells.Range(Start, ActiveCell.End(xlDown)).Count = "i"
    'Cells.End(xlDown).Select
    'ActiveCell.Name = "end"

    Do
    Range(ActiveCell, ActiveCell.End(xlDown)).Select
    With Selection.Cut
    End With
    ActiveCell.Offset(3, 0).Select
    ActiveCell.PasteSpecial
    ActiveCell.Offset(1, 0).Select
    Loop Until IsEmpty(ActiveCell)


    End Sub

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    45,293

    Re: Copy and Paste Runtime Error - Newbie, really struggling here!

    You can't Cut and Paste Special. If you Cut cells manually, you will find the option to Paste Special is not available.

    You'd need to Copy, Paste Special and then go back to delete the cells you don't want.

    Although you have explained what you are trying to do, I don't really understand what you are trying to achieve. Consequently, I can't really advise you on the best approach.

    You may get more input if you post a sample workbook and explain what you are starting with and what you want to end up with.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,770

    Re: Copy and Paste Runtime Error - Newbie, really struggling here!

    You are selecting a rang from a cell named "start" down to the last cell in that column i.e. row 65536. Then you cut this range and try to paste it 3 rows futher down. So the end of this range should land at row 65539 but as I said before the Excel worksheet (version 2003) only contains 65536 rows.

    This is the reason you get the error message.

    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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