Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default delete record based on a value

Hello,

I would like to be able to delete all values greater than 60 on a
spreadsheet.
--
Thank-you and all suggestions are appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default delete record based on a value

Why not just sort and delete?
--
HTH...

Jim Thomlinson


"Anauna" wrote:

Hello,

I would like to be able to delete all values greater than 60 on a
spreadsheet.
--
Thank-you and all suggestions are appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default delete record based on a value

Hi

This example use AutoFilter to do this
The first cell in the range is the header cell


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

DeleteValue = "60"

With ActiveSheet
.Range("A1:A100").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


"Anauna" wrote in message ...
Hello,

I would like to be able to delete all values greater than 60 on a
spreadsheet.
--
Thank-you and all suggestions are appreciated.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default delete record based on a value

Assuming you mean all values in a single column, then you should put on
Autofilter and set the criterion to =60, then delete results.

If you need to look over every cell in the worksheet for values =60, that's
a different story.
Sub DelValues()
Dim c As Range

For Each c In activeSheet.UsedRange
If c.Value = 60 And IsNumeric(c.Value) Then c.Delete
Next 'c

End Sub



"Anauna" wrote in message
...
Hello,

I would like to be able to delete all values greater than 60 on a
spreadsheet.
--
Thank-you and all suggestions are appreciated.



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
Formula to Delete Duplicates but keep one record Lost in Excel Excel Discussion (Misc queries) 4 December 3rd 08 02:37 PM
find last record in macro and delete all after Sherife Excel Discussion (Misc queries) 3 September 18th 06 03:51 AM
Delete record(s) in other cells based on value of one cell. MPope Excel Discussion (Misc queries) 1 October 12th 05 06:57 PM
How to delete duplicated records. Each record has four lines Arcesio Hernandez Excel Discussion (Misc queries) 2 July 26th 05 11:44 PM
How To Delete First Record In A Text File MarkInSalemOR Excel Programming 0 November 8th 04 09:55 PM


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