Results 1 to 11 of 11

Delete method of Range class failed (again)

Threaded View

  1. #1
    Registered User
    Join Date
    06-17-2011
    Location
    Des Moines, Iowa, USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Delete method of Range class failed (again)

    When I run the following code, I get a Run-time Error '1004': Delete method of Range class failed. If there is nothing in column D, then the if statement is not satisfied and the macro runs fine and doesn't do anything.
    Changing the Delete line to 'Rows(i).Delete Shift=x1Up' works just fine, but I would prefer to just delete the selected range.
    Here is the entire macro:
    Sub AssignRequests()
        Dim i As Integer
        i = 2
        Do While i <= Range("OutstandingCount") + 10
        If Range("D" & i) <> "" Then
        Range("PasteRange").Value = Range("A" & i, "D" & i).Value
        
           Range("A" & i, "D" & i).Delete Shift:=x1Up
        
        Else: i = i + 1
        End If
        Loop
    End Sub
    This is my first post, so I hope it is done correctly.
    Thanks!
    Attached Files Attached Files
    Last edited by Kelden; 06-20-2011 at 10:45 AM.

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