VinceF
Board Regular
- Joined
- Sep 22, 2007
- Messages
- 220
- Office Version
- 2016
- Platform
- Windows
Help...Really struggling with this, I'm sure it'll be simple for the experts.
I have a Active X button that executes a macro. I'm trying to have a .wav file (click.wav) play when the button is pressed.
With my extremely limited VBA skills I've been unable to make it happen...The code below is where I'm trying to place it into.
Thanks
VinceF
Win10
Office365
I have a Active X button that executes a macro. I'm trying to have a .wav file (click.wav) play when the button is pressed.
With my extremely limited VBA skills I've been unable to make it happen...The code below is where I'm trying to place it into.
Thanks
VinceF
Win10
Office365
VBA Code:
Sub GenerateMultipleRandomintegers()
For i = 1 To 3
Do
' Calculate number
n = WorksheetFunction.RandBetween(1, 18)
' Check to see if number already used in range
If Application.WorksheetFunction.CountIf(Range("A1:A3"), n) = 0 Then
' If not duplicate, assign to cell and exit loop
Range("A" & i) = n
Exit Do
End If
Loop
Next i
End Sub