Highlight Duplicates with a keyboard long beep

thomasr79

New Member
Joined
May 17, 2007
Messages
24
Hi,

With my basic knowledge (if called that), I have a worksheet which uses:

VBA code for column A to enter the date and time automatically when data is entered in to column B.

Column B is read in from a barcode reader and font changes to red when a duplicate is read in.

Column C is blank and using conditional formatting fills the cell red when finds a duplicate.

However, I would like to:

Highlight the Duplicates the same as above but with a long keyboard beep. I don't think I can add the beep without VBA so could someone give me the full vba code to make the above happen?

Thanks in advance! this is by far the most useful excel site I found (as a novice)
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
Method 1
I think you will find it easier to just put in multiple Beep lines. eg :-
Code:
Beep
Beep
Beep


Method 2
This is the API method, but it seems only to use the PC internal speaker.
Code:
Declare Function Beep Lib "kernel32" _
    (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
'===============================
'- BEEP
'===============================
Sub MyBeep()
    '- Beep Frequency, Duration
       Beep 1500, 1000
End Sub
'================================

Method 3
There is an API method to enable a sound file to be played as used by Windows (eg. .wav files). This is faily complicated. As this plays any .wav file it can be used for music too.

Do a search for Private Declare Function PlaySound Lib "WINMM.DLL"
 

Forum statistics

Threads
1,181,658
Messages
5,931,272
Members
436,786
Latest member
Deniel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top