• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Test field for more than two decimals using VBA

mykl212

New Member
I have uploaded the problem VBA at

https://docs.google.com/leaf?id=0ByeU-4Navqg8MDBkNDQxNTQtMTJjZi00NTVmLTliZjctODIwZDIxOGU5NjYy&hl=en_US&authkey=CJD54LQB

I want to validate a numeric field has two or less decimals, i.e 123.456 is bad.

The field is pasted from another XLS where it was calculate and truncated, rounded, or otherwise made to appear as two decimals.

You can see the CK7 subroutine has my original code commented out. There is now code that is more standard XL but that also fails.

I can work around by not testing, just doing a round myself in the VBA.
 
Can you force the two decimals like so?

ActiveCell.Value = Format(ActiveCell.Value, "#.00")
 
Thanks for the reply but no. It still fails on row J. After multiplying J16 into E and F16 then letting XL compare using IF in G16, XL indicates equal yet the VB still shows unequal.
 
Back
Top