Solved

Excel VBA Rounding Up

Posted on 2011-03-01
4
186 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
ID: 35009560
Something like:
 If Application.ROund(val(xValue),4) = 0.0002 Then

Open in new window

0
 

Author Comment

by:cpatte7372
ID: 35011597
rorya

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

Expert Comment

by:broomee9
ID: 35356955
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

786 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