I am trying to find and delete specific rows in a spreadsheet, however the reference I=
=E2=80=99m looking for e.g. 800411 is not always going to be in the spreadsheet, so my=
macro is not working on all occasions =E2=80=93 any ideas how I can overcome this.
Macro so far: =Sheets(quot;top10monthquot;).SelectCells.Find(What:=3Dquot;800 411quot;, After:=3DActiveC=
ell, LookIn:=3DxlFormulas, LookAt _
:=3DxlPart, SearchOrder:=3DxlByRows, SearchDirection:=3DxlNext, MatchCase:=
=3D _
False, SearchFormat:=3DFalse).Activate
ActiveCell.Rows(quot;1:1quot;).EntireRow.Select
Application.CutCopyMode =3D False
Selection.Delete Shift:=3DxlUp
ActiveCell.Select
=
Any help is appreciated this is a great forum for beginners like me! Thanks
ASAP Utilities, a free Add-in available at www.asap-utilities.com has a
feature that does this nicely..........
Vaya con Dios,
Chuck, CABGx3
quot;Heather O'Malleyquot; wrote:
gt; I am trying to find and delete specific rows in a spreadsheet, however the reference I’m looking for e.g. 800411 is not always going to be in the spreadsheet, so my macro is not working on all occasions – any ideas how I can overcome this.
gt;
gt; Macro so far:
gt;
gt; Sheets(quot;top10monthquot;).SelectCells.Find(What:=quot;80041 1quot;, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
gt; :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
gt; False, SearchFormat:=False).Activate
gt; ActiveCell.Rows(quot;1:1quot;).EntireRow.Select
gt; Application.CutCopyMode = False
gt; Selection.Delete Shift:=xlUp
gt; ActiveCell.Select
gt;
gt; Any help is appreciated this is a great forum for beginners like me! Thanks
gt;
Dim FoundCell as Range
with Worksheets(quot;Top10Monthquot;)
set foundcell = .cells.find(What:=quot;800411quot;, After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
if foundcell is nothing then
'not found
else
foundcell.entirerow.delete
end if
end with
Heather O'Malley wrote:
gt;
gt; I am trying to find and delete specific rows in a spreadsheet, however the reference I’m looking for e.g. 800411 is not always going to be in the spreadsheet, so my macro is not working on all occasions – any ideas how I can overcome this.
gt;
gt; Macro so far:
gt;
gt; Sheets(quot;top10monthquot;).SelectCells.Find(What:=quot;80041 1quot;, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
gt; :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
gt; False, SearchFormat:=False).Activate
gt; ActiveCell.Rows(quot;1:1quot;).EntireRow.Select
gt; Application.CutCopyMode = False
gt; Selection.Delete Shift:=xlUp
gt; ActiveCell.Select
gt;
gt; Any help is appreciated this is a great forum for beginners like me! Thanks
--
Dave Peterson
- Sep 29 Fri 2006 20:09
Macro to find and delete rows!
close
全站熱搜
留言列表
發表留言