Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Implicity
 
Posts: n/a
Default How do I delete multiple cells with decimal, not whole, numbers?

How do I delete multiple cells (ie more than 5,000) which are not whole
numbers? There are many decimal numbers which are scattered across my
spreadsheet, and I would like them deleted. Thankyou.
  #2   Report Post  
dominicb
 
Posts: n/a
Default


Good morning Implicity

Highlight all the range you want checking for decimals and then try
running this code:

Sub test()
occur = 0
On Error Resume Next
For Each rng In Selection
a = rng.Value
If Not a = Round(a, 0) Then
occur = occur + 1
If occur = 1 Then Set NotWhole = rng
If occur < 1 Then Set NotWhole = Union(NotWhole, rng)
End If
Next rng
NotWhole.Select
End Sub

This should highlight all your decimal numbers and ignore any whole
numbers. Once they're all selected just press delete. But BACK UP
BEFORE you do this - I've tested the code, but just in case it selects
something it shouldn't.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=377658

  #3   Report Post  
Tom Peacock
 
Posts: n/a
Default

Assuming your numbers start in cell A1. Put this formula =A1=TRUNC(A1,0)
into cell B2 and copy it all the way down. Integers in column A will have
TRUE in column B those cells with decimals will have FALSE nest to them.
Sort both columns by column B. Integers and non-integers are now grouped,
delete all the rows that have FALSE in column B.

Tom


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
In Excel how do I delete or change the name of a range of cells? Naming and Deleting a Range Name Excel Discussion (Misc queries) 4 September 21st 08 11:00 PM
How do I protect formula cells on multiple sheets? Webdiva Excel Worksheet Functions 0 May 3rd 05 08:29 PM
Locate and delete specific cells David Smith Excel Discussion (Misc queries) 1 January 19th 05 04:45 PM
background formatting across multiple cells Casper Excel Discussion (Misc queries) 0 November 26th 04 11:18 AM
How do I extract cells from multiple workbooks Trevor Excel Discussion (Misc queries) 1 November 25th 04 10:59 PM


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