Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Heather O'Malley
 
Posts: n/a
Default Macro to find and delete rows!

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("top10month").SelectCells.Find(What:=3D"800 411", After:=3DActiveC=
ell, LookIn:=3DxlFormulas, LookAt _
:=3DxlPart, SearchOrder:=3DxlByRows, SearchDirection:=3DxlNext, MatchCase:=
=3D _
False, SearchFormat:=3DFalse).Activate
ActiveCell.Rows("1:1").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
  #2   Report Post  
Posted to microsoft.public.excel.misc
CLR
 
Posts: n/a
Default Macro to find and delete rows!

ASAP Utilities, a free Add-in available at www.asap-utilities.com has a
feature that does this nicely..........

Vaya con Dios,
Chuck, CABGx3



"Heather O'Malley" wrote:

I am trying to find and delete specific rows in a spreadsheet, however the reference Im 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.

Macro so far:

Sheets("top10month").SelectCells.Find(What:="80041 1", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Rows("1:1").EntireRow.Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
ActiveCell.Select

Any help is appreciated this is a great forum for beginners like me! Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Macro to find and delete rows!

Dim FoundCell as Range
with Worksheets("Top10Month")
set foundcell = .cells.find(What:="800411", 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:

I am trying to find and delete specific rows in a spreadsheet, however the reference Im 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.

Macro so far:

Sheets("top10month").SelectCells.Find(What:="80041 1", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Rows("1:1").EntireRow.Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
ActiveCell.Select

Any help is appreciated this is a great forum for beginners like me! Thanks


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete pictures with a macro Noel Rietman Excel Discussion (Misc queries) 1 March 20th 06 04:43 PM
Can't find macro in an Excel file to delete it Ron Excel Discussion (Misc queries) 3 July 1st 05 01:07 PM
How do I find duplicate rows in a list in Excel, and not delete it Matthew in FL Excel Discussion (Misc queries) 2 June 15th 05 09:11 PM
Macro data selection line delete Frantic Excel-er Excel Discussion (Misc queries) 0 May 31st 05 11:46 PM
Macro to find and delete all FALSE statements Woody13 Excel Discussion (Misc queries) 3 December 8th 04 11:16 PM


All times are GMT +1. The time now is 09:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"