Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a series of worksheets, each containing approx 5000 rows of data. This data is ordered in four columns Chainage, Easting, Northing and Elevation.
The data is generated and dumped into excel as a mixture of measured coordinates, and interpolated coordinates, the latter being the more interesting.
I want to delete all rows of information if the first column (the chainage) is not a whole number.
Foe example:
row Chainage Easting Northing Elevation
1....1500........456....653......6
2....1509.203....457....654......5
3....1600........345....653......4
4....1601.23.....456....465......6From the above example I would want to delete rows 2 and 4.
Can anyone suggest a macro / VBA routine for doing so?
Many thanks in advance
RMJ

I think a good solution would be adding the ASAP utilities to your EXCEL, if yoou goto:
http://www.asap-utilities.com/
And then in that site
List of tools>columns & rows> Conditional row and column selectyou will find what you want.

I don't know if this is a one-off but if so you could do it manually.
Highlight the column, change the cell to Number and set the number of of decimal places to the maximum you need you need (eg 3 shown in you rexample).
The round figures should then show a decimal point with zeros after it.
You can then set up an IF function so any cell which has numbers greater than zero after the decimal point is assigned a word or letter in a new column.
Then highlight the whole sheet, got to Data - Sort, sort it by the column with the word or letter in so those rows are all bunched together, then highlight and delete those rows.

I was bit slow there. If you set them to display zeros you don't need to use a funtion because all the entries greater than zero wil bunch together anyway.
I just tried it.

Hi RMJ
Try something like this
Sub Macro3()
' This scans down column A1 to A24
' and delete those rows that are not integersDim x
For x = 1 To 24
If Cells(x, 1) <> Int(Cells(x, 1)) Then
Cells(x, 1).EntireRow.Delete
End If
Next
End Sub

![]() |
msohelp.exe error on Word...
|
Norton Disk Doctor error....
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |