+ Reply to Thread
Results 1 to 7 of 7

Run-time error 13 - Problem deleting rows

Hybrid View

  1. #1
    Registered User
    Join Date
    01-19-2009
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    29

    Run-time error 13 - Problem deleting rows

    Hiya all,

    I'm not the sharpest tool in the shed when it comes to excel programming but I manage. However, I can't seem to get rid of this run-time error 13. Could anyone take a quick peek at the document and spot the problem?

    My intention is this, when typing 'Yes' in the AB column on a certain row, that row is cut from that worksheet and moved to the 'Archive' worksheet, also, simultaneously, I want to send a mail to a specific address.

    Here is when I run into the error, I suspect when the row is removed with the 'Yes', those two macros clash.

    Thanks in advance!

    Macster
    Attached Files Attached Files
    Last edited by Macster; 02-05-2009 at 03:51 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Macster,

    Welcome to the Forum!

    I have looked at your file and cannot find any code that deletes any rows. Please be sure you have posted the correct workbook.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    01-19-2009
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    29
    Many thanks Leith,

    Hm, quite sure that I attached the correct file, this is the code that both initiates the mail function aswell as deleting the row:

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim Dest As Worksheet
        Set Dest = ThisWorkbook.Worksheets("Archive")
        If Not Application.Intersect(Range("AB1:AB400"), Target) Is Nothing Then
            If Target.Value = ("Yes") Then
                Target.Value = ""
                Mail_Range_Outlook_Body
                Target.EntireRow.Copy Destination:=Dest.Range("a1000").End(xlUp).Offset(1, 0)
                Target.EntireRow.Clear
            End If
        End If
    End Sub
    Last edited by Macster; 01-21-2009 at 03:49 AM.

  4. #4
    Registered User
    Join Date
    01-19-2009
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    29
    Should've read the forum rules first, sorry.

  5. #5
    Registered User
    Join Date
    01-19-2009
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Run-time error 13 - Problem deleting rows

    Hm, still trying to solve this one, ideas anyone?

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Run-time error 13 - Problem deleting rows

    Hello Macster,

    Here is the corrected code...
    Private Sub Worksheet_Change(ByVal Target As Range)
    
      Dim Dest As Worksheet
      
        Set Dest = ThisWorkbook.Worksheets("Archive")
        
        Application.EnableEvents = False
          If Not Application.Intersect(Range("AB1:AB400"), Target) Is Nothing Then
            If Target.Cells(1, Target.Columns.Count).Value = "Yes" Then
                Target.Value = ""
                Mail_Range_Outlook_Body
                Target.EntireRow.Copy Destination:=Dest.Range("a1000").End(xlUp).Offset(1, 0)
                Target.EntireRow.Clear
            End If
          End If
        Application.EnableEvents = True
        
    End Sub
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Registered User
    Join Date
    01-19-2009
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Run-time error 13 - Problem deleting rows

    Many thanks Leith.

+ 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