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 entire row based on cell content

I would like to have a macro run down a column of figures,
deleting rows that contain the number 1. I'm a novice so I
have trouble instructing it to stop when the data ends....

TIA!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Delete entire row based on cell content

In a standard module insert:

Sub DeleteRowWith1()
Dim MyRange As Range
Set MyRange = Range("D:D")
For Each c In MyRange
If IsEmpty(ActiveCell.Value) Then
Exit Sub
Else
If c.Value = 1 Then
ActiveCell.EntireRow.Delete
End If
End If
ActiveCell.Offset(1, 0).Select
Next c
End Sub


"PHIL" wrote in message
...
I would like to have a macro run down a column of figures,
deleting rows that contain the number 1. I'm a novice so I
have trouble instructing it to stop when the data ends....

TIA!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Delete entire row based on cell content

Sub deleterowwithoneinit()
'
' Macro1 Macro
' Macro recorded 3/12/2003 by me
'
For Each c In Worksheets("Sheet1").Range("A:A")
If c.Value = 1 Then
c.EntireRow.Delete
End If
Next

End Sub

Wazza McG


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
Specify a row based on data from a cell to delete entire row..... Fadedmartinikiss Excel Discussion (Misc queries) 0 March 11th 09 08:39 PM
How Do I Condition A Entire Row, Based On The Content Of A Single Frustrated-Emmily New Users to Excel 6 November 6th 08 04:57 PM
Delete Row based off cell content Chuck Neal Excel Discussion (Misc queries) 3 March 29th 06 08:52 PM
how do I highlight an entire row based on the value of its content strider Excel Discussion (Misc queries) 1 December 16th 05 09:17 PM
Hide/Delete entire rows based in the content of one cell Clueless Excel Discussion (Misc queries) 2 October 3rd 05 02:40 PM


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