Results 1 to 22 of 22

Ding sound for Cells with Equal Values

Threaded View

  1. #1
    Registered User
    Join Date
    02-20-2009
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2003
    Posts
    32

    Ding sound for Cells with Equal Values

    'Hi,

    'I was wondering how to apply this code to include specifically these ranges in pairs: H50 & H51, H102 & H103, H154 & H155, and H206 & H207.

    'tried to cut and paste the code from Private Sub to End Sub changing only
    the Ranges (see above), but it didn't work.

    'I am totally new to VBA

    Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
        "sndPlaySoundA" (ByVal lpszSoundName As String, _
        ByVal uFlags As Long) As Long
     
    Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
        Static OnlyOnce As Boolean
     
        If OnlyOnce Then Exit Sub
        If Range("H51").Value = "" Or Range("H51").Value = 0 Then Exit Sub
        If Range("H50").Value = Range("H51") Then
            sndPlaySound32 "ding", 1&
            OnlyOnce = True
        End If
     
    End Sub
    Last edited by VBA Noob; 02-21-2009 at 06:03 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1