Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RMJ RMJ is offline
external usenet poster
 
Posts: 1
Default Delete certain rows of data...

I have a number of work sheets containg coordinate data.

data is sorted in the form....

Chainage, Easting, Northing, Elevation,
1609.456 x1 y1 z1
1610 x2 y2 z2
1611.345 x3 y3 z3
1620 x4 y4 z4

ad infinitum, ad nauseum

Can anyone suggest a routine that will delete the entire row of dat
not containing whole numbers in the first column?

Thanks for any help in advance.

Rhodr

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Delete certain rows of data...

This code should do the trick:

' Start at the top
Range("A1").Select

' Move down until it finds an empty cell
Do Until ActiveCell = ""
' Check if this cell contains a whole number
If IsNumeric(ActiveCell) Then
If Int(ActiveCell) < ActiveCell Then
' Cell contains a number, but not a whole
number so delete it
ActiveCell.EntireRow.Delete
End If
End If

ActiveCell.Offset(1, 0).Range("A1").Select
Loop

' Return to the top
Range("A1").Select

HTH
Helen




-----Original Message-----
I have a number of work sheets containg coordinate data.

data is sorted in the form....

Chainage, Easting, Northing, Elevation,
1609.456 x1 y1 z1
1610 x2 y2 z2
1611.345 x3 y3 z3
1620 x4 y4 z4

ad infinitum, ad nauseum

Can anyone suggest a routine that will delete the entire

row of data
not containing whole numbers in the first column?

Thanks for any help in advance.

Rhodri


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Delete certain rows of data...

Rhodri,

Here's a macro, assuming your values are in column A. If you have a
lot of data, this will be *much* quicker than deleting individual
rows.

Sub DeleteNonIntegerValues()
Range("A1").EntireColumn.Insert
Range("A1").Value = "Keep"
Range("A2").FormulaR1C1 = _
"=IF(RC[1]<INT(RC[1]),""Trash"",""Keep"")"
Range("A2").Copy Range("A2:A" &
Range("A2").CurrentRegion.Rows.Count)
With Range(Range("A1"), Range("A1").End(xlDown))
.Copy
.PasteSpecial Paste:=xlValues
End With
Cells.Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending
Columns("A:A").Find(What:="Trash", After:=Range("A1")).Select
Range(Selection, Range("A65536").End(xlUp)).EntireRow.Delete
Range("A1").EntireColumn.Delete
End Sub

HTH,
Bernie
MS Excel MVP

"RMJ " wrote in message
...
I have a number of work sheets containg coordinate data.

data is sorted in the form....

Chainage, Easting, Northing, Elevation,
1609.456 x1 y1 z1
1610 x2 y2 z2
1611.345 x3 y3 z3
1620 x4 y4 z4

ad infinitum, ad nauseum

Can anyone suggest a routine that will delete the entire row of data
not containing whole numbers in the first column?

Thanks for any help in advance.

Rhodri


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete certain rows of data...

Thankyou to both of you for your help - problem now sorted!

:

--
Message posted from http://www.ExcelForum.com

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 rows data moving njoseph Excel Discussion (Misc queries) 3 June 1st 10 11:07 PM
Delete specific rows of data Roger Bell New Users to Excel 3 June 19th 07 08:40 AM
How do I delete all rows that contain no red highlighted data? Linda Hudock Excel Discussion (Misc queries) 7 May 22nd 06 09:09 AM
Delete rows with no data Mindie Setting up and Configuration of Excel 1 November 30th 05 09:24 PM
Macro to delete rows with same data Connie Martin Excel Worksheet Functions 12 November 22nd 05 01:18 PM


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

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

About Us

"It's about Microsoft Excel"