Solved

Excel VBA Rounding Up

Posted on 2011-03-01
4
181 Views
Last Modified: 2012-05-11
Hello Experts,

I have amended some of the code provided by an expert to alert when a certain value is reached in a cell, basically its:

For Each xCell In Range("O2:O" & xLastRow)
    xValue = xCell.Value
    If Not IsError(xValue) Then
        If xValue <> "" And xValue = 0.0002 Then
            PlayTheSound "Windows XP Print complete.wav"
            Cells(1, 15).Interior.Color = 255
            Point02 = True
            Exit For
        End If
    End If
Next

I would like a sound when xValue = 0.0002 (0.02%)

Originally it was < 0.0002

However, I think because I'm after an exact number its not alerting. So my guess is I think it needs to be rounded.

I have attached the spreadsheet to illustrate. The cells in question are in column O

I should mention that I have conditionally formatted the column to highlight when the value goes below < 0.0002. But as I mentioned, I would just like a sound alert when the actual value is reached.

The sound has been taken care of by Chris (another expert). I now just need it to be activated when 0.0002 is actually reached.

I hope my explanation isn't to convoluted.

Cheers


Trade-Day--10-Experts-1-.xlsm
0
Comment
Question by:cpatte7372
4 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
Comment Utility
Something like:
 If Application.ROund(val(xValue),4) = 0.0002 Then

Open in new window

0
 

Author Comment

by:cpatte7372
Comment Utility
rorya

Thanks for responding. I will check it out....
0
 
LVL 24

Expert Comment

by:broomee9
Comment Utility
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now