Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Start a macro when a clock goes down to zero
I am trying to make a macro work when a clock count down to zero. I have a
macro that is working when I am in some way activate the worksheet. How can I activate the worksheet without doing a manual thing in it. I have a clock running in the worksheet. My macro looks like this: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Select Case Range("E29") Case Is = 1 Range("E30").Select (This doesn´t happen before I do something in the End Select worksheet) End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Start a macro when a clock goes down to zero
You can use the ontime method. For example, the code below will play a sound for each of the
date/times listed in column A of the active sheet. (Just to give you an idea of how it is coded....) HTH, Bernie MS Excel MVP Private Declare Function PlaySound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal lpszName As String, _ ByVal hModule As Long, ByVal dwFlags As Long) As Long Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 Sub PlayWAV() WAVFile = "C:\Program Files\Ahead\Nero\Trumpet1.wav" Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME) End Sub Sub SetAlarms() Application.Calculate Dim myCell As Range For Each myCell In Range("A1", Range("A65536").End(xlUp)) Application.OnTime myCell.Value, "PlayWAV" Next myCell End Sub Sub CancelAlarms() Dim myCell As Range For Each myCell In Range("A1", Range("A65536").End(xlUp)) Application.OnTime myCell.Value, "PlayWAV", , False Next myCell End Sub "BFSWE" wrote in message ... I am trying to make a macro work when a clock count down to zero. I have a macro that is working when I am in some way activate the worksheet. How can I activate the worksheet without doing a manual thing in it. I have a clock running in the worksheet. My macro looks like this: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Select Case Range("E29") Case Is = 1 Range("E30").Select (This doesn´t happen before I do something in the End Select worksheet) End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Start a macro when a clock goes down to zero
Thanks Bernie.
I will try it tomorrow. /Bo "Bernie Deitrick" skrev: You can use the ontime method. For example, the code below will play a sound for each of the date/times listed in column A of the active sheet. (Just to give you an idea of how it is coded....) HTH, Bernie MS Excel MVP Private Declare Function PlaySound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal lpszName As String, _ ByVal hModule As Long, ByVal dwFlags As Long) As Long Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 Sub PlayWAV() WAVFile = "C:\Program Files\Ahead\Nero\Trumpet1.wav" Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME) End Sub Sub SetAlarms() Application.Calculate Dim myCell As Range For Each myCell In Range("A1", Range("A65536").End(xlUp)) Application.OnTime myCell.Value, "PlayWAV" Next myCell End Sub Sub CancelAlarms() Dim myCell As Range For Each myCell In Range("A1", Range("A65536").End(xlUp)) Application.OnTime myCell.Value, "PlayWAV", , False Next myCell End Sub "BFSWE" wrote in message ... I am trying to make a macro work when a clock count down to zero. I have a macro that is working when I am in some way activate the worksheet. How can I activate the worksheet without doing a manual thing in it. I have a clock running in the worksheet. My macro looks like this: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Select Case Range("E29") Case Is = 1 Range("E30").Select (This doesn´t happen before I do something in the End Select worksheet) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Incremental time values based upon clock in and clock out times | Excel Discussion (Misc queries) | |||
How do I calculate time in excel (clock in and clock out | Excel Discussion (Misc queries) | |||
Change EXCEL Clock to Standard Clock or Military Time | Excel Worksheet Functions | |||
Calculating Clock start time in Excel | Excel Discussion (Misc queries) | |||
Start Clock/Stop Clock | Excel Discussion (Misc queries) |