Results 1 to 3 of 3

Delete Row based on record found in cell

Threaded View

capnhud Delete Row based on record... 03-19-2012, 02:04 PM
Kelshaer Re: Delete Row based on... 03-19-2012, 03:43 PM
capnhud Re: Delete Row based on... 03-20-2012, 09:04 AM
  1. #1
    Registered User
    Join Date
    06-04-2007
    MS-Off Ver
    Excel 2007
    Posts
    94

    Delete Row based on record found in cell

    I can perform a delete row based on a value if it is 0 or greater, but how would I modify something such as this

    Public Sub delete_row()
    Dim i
    Range("A1").Select
    For i = 1 To Range("A1", Cells(Rows.Count, 1).End(xlUp)).Rows.Count
        If ActiveCell.Offset(i, 0) = False Then
            If ActiveCell.Offset(i, 0) = "" Then Exit For
            ActiveCell.Offset(i, 0).EntireRow.Delete
            i = i - 1
        End If
    Next i
    End Sub
    so that cells that begin with BRNG-XXXX-XXXXXX the whole row is deleted? I tried just inserting
    Option Explicit
    
    Public Sub deleted_row()
    Dim i
    Range("C2").Select
    For i = 1 To Range("C2", Cells(Rows.Count, 1).End(xlUp)).Rows.Count
        'put your value you want after the = sign to achieve your objective. (0)
        If ActiveCell.Offset(i, "BRNG") = True Then
            If ActiveCell.Offset(i, 0) = "" Then Exit For
            ActiveCell.Offset(i, 0).EntireRow.Delete
            i = i - 1
        End If
    Next i
    End Sub
    "BRNG" but i get

    Run-time error '13": Type Mismatch
    Attached Files Attached Files
    Last edited by capnhud; 03-20-2012 at 09:04 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