Adding empty row with code
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. |
Adding empty row with code
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 -- Charles Chickering "A good example is twice the value of good advice." "SITCFanTN" wrote: 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. |
Adding empty row with code
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 -- Charles Chickering "A good example is twice the value of good advice." "Charles Chickering" wrote: 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 -- Charles Chickering "A good example is twice the value of good advice." "SITCFanTN" wrote: 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. |
All times are GMT +1. The time now is 05:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com