Results 1 to 20 of 20

Move Entire Rows to Archive Worksheet

Threaded View

  1. #1
    Registered User
    Join Date
    08-09-2010
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    10

    Move Entire Rows to Archive Worksheet

    I have a spreadsheet that has been working perfectly for months. Now, intermittently, when I attempt to move of a row (by entering "Yes" in the column), I get this error
    Run-time error'-2147417848 (80010108)':
    Method 'Insert' of object 'Range' failed

    I have 9 sheets. All sheets have the following code onto the Archive Tab:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rngDest As Range
    Set rngDest = Worksheets("Archive").Range("rngDest")
    Dim rngTrigger As Range
     
    ' Limit the trap area to range of cells in which completed dates are entered as defined above
    If Not Intersect(Target, Range("rngTrigger")) Is Nothing Then
     
    ' Only trigger if the value entered is TRUE
        
         If Target.Value = "Yes" Then
    'Ensure subsequent deletion of 'moved' row does NOT cause the Change Event to run again and get itself in a loop!
            Application.EnableEvents = False
            Target.EntireRow.Select
            Selection.Cut
            rngDest.Insert Shift:=xlDown
            Selection.Delete
    ' Reset EnableEvents
            Application.EnableEvents = True
        End If
    End If
    
        On Error Resume Next
    If Not Intersect(Target, Range("B:B")) Is Nothing Then
            With Worksheets("Home Office").Sort
                  .SortFields.Clear
                  .SortFields.Add Key:=Range("B:B"), _
                       SortOn:=xlSortOnValues, _
                       Order:=xlAscending, _
                       DataOption:=xlSortNormal
                       
          .SetRange Range("A5:F25")
                  .Header = xlNo
                  .MatchCase = False
                  .Orientation = xlTopToBottom
                  .SortMethod = xlPinYin
                  .Apply
              End With
        End If
     End Sub
    The code stops on the bolded line above, then in the bottom left hand corner of the screen it says "Select Destination and click enter or choose Paste".

    If I go nowhere except to the top Menu and click Paste, Excel craps out, recovers and when it comes back, the Row has been moved to the Archive.

    I checked the code over and over. There isn't a clear reason why it should work for months and now doesn't....or that it should work 4 or 5 times, different sheets, different rows, then gives the error.

    Additionally, I've checked the rngDest Named Range. It correctly shows the next blank row on the page as =ARCHIVE!$59:$59, and increased with each add, correctly. Everything appears to be correct...and has been working. Until today.

    Could my code to sort have anything to do with it?

    I can upload the sheet if someone would like to test it.
    ANY help would be much appreciated. Upper management uses this sheet and I would like to get it working before it happens to one of them.

    Thanks so much,
    LBinGA
    Last edited by LBinGA; 12-30-2015 at 10:42 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro to cut/paste entire rows from one tab to Archive tab based on criteria in drop down
    By kmort in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-23-2015, 09:36 AM
  2. Trying to Move an entire Row from one sheet to another Archive sheet.. Also..
    By Gurbo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-15-2014, 10:50 AM
  3. Replies: 1
    Last Post: 11-14-2014, 08:35 PM
  4. [SOLVED] How to move entire rows if a condition is met
    By mcculltc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-12-2013, 03:46 PM
  5. Replies: 1
    Last Post: 09-14-2012, 09:02 PM
  6. Move entire row automatically to another worksheet if condition is met
    By starr5128 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2011, 06:38 PM
  7. How to archive an entire spreadsheet?
    By rarin in forum Excel General
    Replies: 3
    Last Post: 08-28-2007, 08:55 AM

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