LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Check for more than 2 decimal places

Sub CheckDecimals()
Dim cell As Range

For Each cell In Selection
If cell.Value < Round(cell.Value, 2) Then
MsgBox cell.Address
End If
Next cell

End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Brian" <Brian @discussions.microsoft.com wrote in message
...
I'm look for a macro that will check the number of decimal places in a

range
of values. I would like to have a pop up box alert the user when a cell

is
found in that range that contains more than 3 decimal places. For example

if
the numbers in a range are 50.35, 25.2, 35.235, and 35, the macro would

stop
on that cell and deliver a pop up box showing me that it contains more

than 3
decimal places. I can create an excel formula to check the information:
=if(B2<trunc(b2,2,"error",B2) however I don't know enough VBA to get this
fomula into a macro to check a range.
Any help would be great.

Thanks
Brian



 
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 for: Format Decimal places? nastech Excel Discussion (Misc queries) 16 November 4th 05 02:25 PM
Excel adds phantom decimal places: why? Dave O Excel Discussion (Misc queries) 1 August 16th 05 06:25 PM
Excel defaulting to 3 decimal places when using the gen. format cprtrain Excel Discussion (Misc queries) 1 July 31st 05 04:29 AM
Max decimal places SusieQ Excel Discussion (Misc queries) 1 July 13th 05 07:57 PM
decimal places within a formula Paul01 Excel Discussion (Misc queries) 4 June 3rd 05 07:53 PM


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