Link to home
Start Free TrialLog in
Avatar of cpatte7372
cpatte7372Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel VBA Rounding Up

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
ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cpatte7372

ASKER

rorya

Thanks for responding. I will check it out....
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.