Adding empty row with code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to add an empty row in my sheet based on the last entry in
column I that says "No Match". I'm sorting based on Col I so all the "No
Matches" display first, then all the "Matches". Is there a way to use code
to look at the text in Col I and add and empy row based on the last text
entry of "No Match". I've searched previous posts with no luck. Thanks for
your help.
 
Hi try this:
Dim r As Range
Set r = Columns("I").Find(What:="No Match, _
After:=Range("I1"), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, MatchCase:=True)
If Not r Is Nothing Then r.Offset(1).EntireRow.Insert
 
Oops. missed a closing quote.

Dim r As Range
Set r = Columns("I").Find(What:="No Match", _
After:=Range("I1"), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, MatchCase:=True)
If Not r Is Nothing Then r.Offset(1).EntireRow.Insert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top