Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Copy, Paste, check and just about everything else!

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    Hi all,

    I need some code to do the following:

    When I press a button it copies the active row and pastes it in the next available row in a sheet called 'Completed'. Can anyone help?

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hello AudioJoe

    How about

    Sub DoIt()
    ActiveCell.EntireRow.Copy Destination:= _
    Sheets("Completed").Range("A65536").End(xlUp).Cells(2, 1)
    End Sub

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    It's giving me run time error 1004 on that mate, it says:

    Copy Method of Range Class Failed

    Any ideas?

  4. #4
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Works fine here! How are you running the code?



  5. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I tried putting into a command button click event, but that didn't work, so I decided to leave it as a macro and just put Run ("DoIt") on the end of the command button click commands, but that didnt work either

  6. #6
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Set the TakeFocus******* Property to False.



  7. #7
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi
    This works.

    Sub nextrow()
    Dim ThisRow
    Dim LastRow
    Dim ReturnToSheet

    ThisRow = ActiveCell.Row
    ReturnToSheet = ActiveSheet.Name
    ActiveSheet.Rows(ThisRow & ":" & ThisRow).Copy
    Sheets("Complete").Activate
    LastRow = Sheets("Complete").Range("a1:A" & Range("A65536").End(xlUp).Row).Rows.Count + 1
    ActiveSheet.Rows(LastRow & ":" & LastRow).Select
    ActiveSheet.Paste
    Sheets(ReturnToSheet).Activate
    End Sub

    Have a nice day!
    Tom

  8. #8
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Still no joy man, I dont know what the problem is!

  9. #9
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Tom, didn't work on mine. You have a nice day too though

  10. #10
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I keep getting the same problem. The code that Tom gave me works fine up to the:

    Activesheet.Paste

    command. Here it says 'Paste Method of Worksheet Class failed'

    You can't tell, but I'm shrugging right now

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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