Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-02-2017, 06:12 PM
ThisGuyJohn ThisGuyJohn is offline Macro to delete rows not containing specific text Windows 7 64bit Macro to delete rows not containing specific text Office 2016
Novice
 
Join Date: Jan 2017
Posts: 6
ThisGuyJohn is on a distinguished road
Default

When you run this it will delete all the rows with blank spaces country and spain

Code:
Sub Filter()
    Dim b As Long
    With ActiveSheet
        For b = .Cells(Rows.Count, "b").End(xlUp).Row To 1 Step -1
            With .Rows(b)
                
                    If Not .Range("b1").Value = "Country" Then
                    If Not .Range("b1").Value = "Spain" Then
                    If Not .Range("b1").Value = vbNullString Then
                        .Delete
                    End If
                    End If
                    End If
                
            End With
        Next b
    End With
    
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to delete rows not containing specific text Macro to delete text in specific styles ljd108 Word VBA 14 01-22-2019 01:22 PM
Macro to delete rows not containing specific text Macro to delete text from cells with specific format Soenke Word VBA 4 09-01-2016 08:55 AM
Macro to delete rows not containing specific text Macro to delete all empty rows from all tables braddgood Word VBA 15 10-02-2015 01:54 PM
Macro to delete rows not containing specific text Macro to conditionally delete rows Steve_D Excel 2 08-24-2012 09:37 PM
Macro to delete rows not containing specific text Macro to delete rows with all empty cells ubns Excel Programming 2 08-14-2012 02:01 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft