Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Two Macros at the same time?? is it possible


Hi, And Many Thanks in advance!

I would like to add a timing range and /or Shape, button to show for a
while "10 Seconds" the time going down
and while going down be able to press one other button, and run the
macro attached to it.
Is it Posibble??


My Try:
For X = 10 To 0 Step -1
Activesheet.Buttons("Time").Caption = X
'or Range("A1").Value=X
Application.Wait Now + TimeValue("00:00:01")
Next X


'so when I am showing this timing going down, be able to press a few
other macros.

Am I missing anything, is it possible??
Do I have to attach any doevents?? do loop??
Any Idea?

Thanks


--
0000_AAAA_0000
------------------------------------------------------------------------
0000_AAAA_0000's Profile: http://www.excelforum.com/member.php...o&userid=12480
View this thread: http://www.excelforum.com/showthread...hreadid=277113

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Two Macros at the same time?? is it possible

Look in help at DoEvents


-----Original Message-----

Hi, And Many Thanks in advance!

I would like to add a timing range and /or Shape, button

to show for a
while "10 Seconds" the time going down
and while going down be able to press one other button,

and run the
macro attached to it.
Is it Posibble??


My Try:
For X = 10 To 0 Step -1
Activesheet.Buttons("Time").Caption = X
'or Range("A1").Value=X
Application.Wait Now + TimeValue("00:00:01")
Next X


'so when I am showing this timing going down, be able to

press a few
other macros.

Am I missing anything, is it possible??
Do I have to attach any doevents?? do loop??
Any Idea?

Thanks


--
0000_AAAA_0000
----------------------------------------------------------

--------------
0000_AAAA_0000's Profile:

http://www.excelforum.com/member.php?
action=getinfo&userid=12480
View this thread:

http://www.excelforum.com/showthread...hreadid=277113

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Two Macros at the same time?? is it possible

no. sorry to say. when one macro is running, it has
command of the CPU. no other actions or interrupt requests
can proceed untill the macro has stopped. You can throw in
a few doevents but that will only free the CPU to do
system events.
so running 2 macros at once is not possible.
as for a timer for the macro, unforumately there is no
timer control built in to excel. you can use the status
bar by adding application.statusbar = "yourmessage" in
your code at various stages to let you know about where
the macro is but that is about it. when done make sure you
set the status bar to nothing.
sorry.
Regards
Frank
-----Original Message-----

Hi, And Many Thanks in advance!

I would like to add a timing range and /or Shape, button

to show for a
while "10 Seconds" the time going down
and while going down be able to press one other button,

and run the
macro attached to it.
Is it Posibble??


My Try:
For X = 10 To 0 Step -1
Activesheet.Buttons("Time").Caption = X
'or Range("A1").Value=X
Application.Wait Now + TimeValue("00:00:01")
Next X


'so when I am showing this timing going down, be able to

press a few
other macros.

Am I missing anything, is it possible??
Do I have to attach any doevents?? do loop??
Any Idea?

Thanks


--
0000_AAAA_0000
----------------------------------------------------------

--------------
0000_AAAA_0000's Profile:

http://www.excelforum.com/member.php?
action=getinfo&userid=12480
View this thread:

http://www.excelforum.com/showthread...hreadid=277113

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Two Macros at the same time?? is it possible

Hi,

Yes, you can do this (kind of). As Frank pointed out, you cannot run 2
separate VBA procedures at once. However, you could use Application.OnTime
to "run" your countdown timer. Between calls to the subroutine used in
OnTime (which would change the caption of your countdown button), your users
would be able to click other buttons to launch other macros. But the OnTime
procedure would not run again until the other code had finished with its
execution.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


0000_AAAA_0000 wrote:
Hi, And Many Thanks in advance!

I would like to add a timing range and /or Shape, button to show for a
while "10 Seconds" the time going down
and while going down be able to press one other button, and run the
macro attached to it.
Is it Posibble??


My Try:
For X = 10 To 0 Step -1
Activesheet.Buttons("Time").Caption = X
'or Range("A1").Value=X
Application.Wait Now + TimeValue("00:00:01")
Next X


'so when I am showing this timing going down, be able to press a few
other macros.

Am I missing anything, is it possible??
Do I have to attach any doevents?? do loop??
Any Idea?

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Two Macros at the same time?? is it possible

OnTime might well fail if the other code is running at the the time that the
OnTime call is meant to be processed. It's clunky and has rarely worked
reliably for me, so I came up with an activex wrapper for the VB timer. You
can download this VBA timer from my site below.

As an illustration, I have just tested the following in Excel XP. Create a
form, with one command button, two labels, and add the VBA control to the
form. Set the timer properties to enabled and an interval of 1000, then run
the form. When first launched you'll see label1 updating with the time. When
you click the command button, you'll see the time continue to be updated
even while label2 shows the counter value.

Private Sub CommandButton1_Click()
Dim lCounter As Long
For lCounter = 1 To 10000000
Label2.Caption = lCounter
DoEvents
Next lCounter
End Sub

Private Sub Timer1_Timer()
Label1.Caption = "The time is: " & Time
End Sub

Robin Hammond
www.enhanceddatasystems.com


"Jake Marx" wrote in message
...
Hi,

Yes, you can do this (kind of). As Frank pointed out, you cannot run 2
separate VBA procedures at once. However, you could use
Application.OnTime to "run" your countdown timer. Between calls to the
subroutine used in OnTime (which would change the caption of your
countdown button), your users would be able to click other buttons to
launch other macros. But the OnTime procedure would not run again until
the other code had finished with its execution.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


0000_AAAA_0000 wrote:
Hi, And Many Thanks in advance!

I would like to add a timing range and /or Shape, button to show for a
while "10 Seconds" the time going down
and while going down be able to press one other button, and run the
macro attached to it.
Is it Posibble??


My Try:
For X = 10 To 0 Step -1
Activesheet.Buttons("Time").Caption = X
'or Range("A1").Value=X
Application.Wait Now + TimeValue("00:00:01")
Next X


'so when I am showing this timing going down, be able to press a few
other macros.

Am I missing anything, is it possible??
Do I have to attach any doevents?? do loop??
Any Idea?

Thanks




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
running macros at specified time Davo1 Excel Discussion (Misc queries) 2 August 20th 09 10:31 PM
First time deleting macros [email protected] Excel Discussion (Misc queries) 1 November 16th 07 11:00 PM
Time keys in macros Sudhir Amin Excel Discussion (Misc queries) 0 August 1st 07 04:36 PM
Time Delay for Macros [email protected] Excel Discussion (Misc queries) 1 May 15th 07 02:42 PM
running macros at a set time Monica Excel Discussion (Misc queries) 1 December 12th 06 11:03 PM


All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"