+ Reply to Thread
Results 1 to 2 of 2

Deleting rows if specific cell is blank or have specific text

Hybrid View

  1. #1
    Registered User
    Join Date
    03-04-2013
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    7

    Deleting rows if specific cell is blank or have specific text

    Dear all,

    I have a problem.
    I want to create in VBA one code that starting in the cell "A14" to for example cell "A5000" to delete the row where in this range there is blank content or the text "Total do Empregado" or "Empregado:" or "Total da Secção" or "Total do Departamento" or "Total Geral".

    can you please help me out.
    I attached the file
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Deleting rows if specific cell is blank or have specific text

    Try this code:
    Sub DeleteRows()
        Application.ScreenUpdating = False
        Dim bottomC As Integer
        bottomC = Range("C" & Rows.Count).End(xlUp).Row
        Dim x As Integer
        For x = bottomC To 14 Step -1
            If Cells(x, 1) = "" Or Cells(x, 1) = "Total  do Empregado" Or Cells(x, 1) = "Empregado:" Or Cells(x, 1) = "Total da Secção" Or Cells(x, 1) = "Total Geral" Then
                Rows(x).EntireRow.Delete
            End If
        Next x
        Application.ScreenUpdating = True
    End Sub

+ 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