Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default delete data rows in excel by using a macro?

I need a macro to delete rows in a 1,000+ page excel report that are
identified by data in a specific column.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default delete data rows in excel by using a macro?

Sub DeleteRows()
Dim rng as Range
With columns(3)
Do
set rng = .Find(What:="ABC", _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
if not rng is nothing then
rng.EntireRow.Delete
else
exit do
End if
Loop
end Sub

--
Regards,
Tom Ogilvy

"Marcia" wrote:

I need a macro to delete rows in a 1,000+ page excel report that are
identified by data in a specific column.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default delete data rows in excel by using a macro?

I have never created macros. Can you give me the step by step. Not sure
where to start

"Tom Ogilvy" wrote:

Sub DeleteRows()
Dim rng as Range
With columns(3)
Do
set rng = .Find(What:="ABC", _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
if not rng is nothing then
rng.EntireRow.Delete
else
exit do
End if
Loop
end Sub

--
Regards,
Tom Ogilvy

"Marcia" wrote:

I need a macro to delete rows in a 1,000+ page excel report that are
identified by data in a specific column.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default delete data rows in excel by using a macro?

It might be easier for you to select your data, then do
Data=filter=Autofilter

Select the column that you want to use to determine which rows to delete and
in that dropdown, select the value that specifies a row for deletion. Now,
only the header row and the rows to be deleted are visible. Select all the
data but the header row and do Edit=Delete and if necessary, select
entirerow.

Now do Data=filter=Autofilter to turn off the autofilter and only the data
you wanted to retain should be left.

Practice this on a copy of your data.

If you want to learn how to use macros, check some of these out:


http://msdn.microsoft.com/office/und.../odc_super.asp

http://msdn.microsoft.com/office/und...d/default.aspx

http://www.mvps.org/dmcritchie/excel/excel.htm

http://www.mvps.org/dmcritchie/excel/getstarted.htm


-------------
Tutorial - the links to the VBA tutorials follow the Excel tutorial links.
http://www.mvps.org/dmcritchie/excel....htm#tutorials

--
Regards,
Tom Ogilvy


"Marcia" wrote:

I have never created macros. Can you give me the step by step. Not sure
where to start

"Tom Ogilvy" wrote:

Sub DeleteRows()
Dim rng as Range
With columns(3)
Do
set rng = .Find(What:="ABC", _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
if not rng is nothing then
rng.EntireRow.Delete
else
exit do
End if
Loop
end Sub

--
Regards,
Tom Ogilvy

"Marcia" wrote:

I need a macro to delete rows in a 1,000+ page excel report that are
identified by data in a specific column.

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
Macro to delete blank rows and move data/info samoan Excel Discussion (Misc queries) 3 September 19th 08 04:50 PM
Macro to delete blank rows in a data range Youlan Excel Discussion (Misc queries) 5 September 17th 08 08:51 AM
Macro to delete rows containing specific data Slohcin New Users to Excel 2 December 20th 06 11:52 AM
Macro to delete rows with same data Connie Martin Excel Worksheet Functions 12 November 22nd 05 01:18 PM
delete rows using macro when no data in column Derek Chambers Excel Programming 1 October 21st 04 12:22 PM


All times are GMT +1. The time now is 11:12 PM.

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"