Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
JPriest
 
Posts: n/a
Default Deleting rows based on a cell value


Good morning,
I have a very large worksheet, some 15,000 entries, and I would like to
delete all the rows with "no" in col G. Is there a macro for this?

Thank you in advance,
Jeff


--
JPriest
------------------------------------------------------------------------
JPriest's Profile: http://www.excelforum.com/member.php...o&userid=24695
View this thread: http://www.excelforum.com/showthread...hreadid=394939

  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Hi JPriest

Look here for examples
http://www.rondebruin.nl/delete.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JPriest" wrote in message
...

Good morning,
I have a very large worksheet, some 15,000 entries, and I would like to
delete all the rows with "no" in col G. Is there a macro for this?

Thank you in advance,
Jeff


--
JPriest
------------------------------------------------------------------------
JPriest's Profile: http://www.excelforum.com/member.php...o&userid=24695
View this thread: http://www.excelforum.com/showthread...hreadid=394939



  #3   Report Post  
JPriest
 
Posts: n/a
Default


Hi Ron,

I checked that link out this morning and followed the instructions, but
everytime I ran the Macro, i got an error, 4683 if i recall correctly.

Any suggestions?

As a follow-up; what's a good source to learn VBA? any suggested
sites/readings?

To do more, I'd like to know more!


--
JPriest
------------------------------------------------------------------------
JPriest's Profile: http://www.excelforum.com/member.php...o&userid=24695
View this thread: http://www.excelforum.com/showthread...hreadid=394939

  #4   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Hi JPriest

Which example do you use?

Try this first :

Here is a filter example
In this Example "G1" is the header cell.

If your header start in G4 then change the range to G4:G15000

Sub Delete_with_Autofilter()
Dim DeleteValue As String
Dim rng As Range

DeleteValue = "no"
' This will delete the rows with "no" in the Range("G1:G15000")
With ActiveSheet
.Range("G1:G15000").AutoFilter Field:=1, Criteria1:=DeleteValue
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete

End With
.AutoFilterMode = False
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JPriest" wrote in message
...

Hi Ron,

I checked that link out this morning and followed the instructions, but
everytime I ran the Macro, i got an error, 4683 if i recall correctly.

Any suggestions?

As a follow-up; what's a good source to learn VBA? any suggested
sites/readings?

To do more, I'd like to know more!


--
JPriest
------------------------------------------------------------------------
JPriest's Profile: http://www.excelforum.com/member.php...o&userid=24695
View this thread: http://www.excelforum.com/showthread...hreadid=394939



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
Insert rows based on specific value bob Excel Worksheet Functions 6 February 29th 08 07:11 PM
Conditional formatiing based on another cell Number_8 Excel Discussion (Misc queries) 3 March 13th 06 12:35 PM
Insert a number of rows based on a value in a cell on active row iRocco Excel Worksheet Functions 0 August 10th 05 08:46 PM
VBA 'deleting row if a cell in column A is a zero. Charlie Excel Worksheet Functions 4 December 7th 04 04:50 PM
Returning a Value to a Cell Based on a Range of Uncertain Size amc422 Excel Worksheet Functions 7 November 14th 04 03:03 PM


All times are GMT +1. The time now is 03:07 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"