Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Instruction Delay

IS it possible to program a button to do something simple, such as
input a "1" into cell A1 but 10 seconds after the button is pressed.

I'm looking for something like:

Private Sub CommandButton1_Click()
"10 seconds timer" (and then)
Range("a1") = 1
end sub

Cheers,

Craig

--
The Zero ST
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Instruction Delay

It is quite easy. Just have your buttton code schedule an OnTime routine to
perform the action. See:

http://www.cpearson.com/excel/OnTime.aspx



--
Gary''s Student - gsnu200738


"Craig Coope" wrote:

IS it possible to program a button to do something simple, such as
input a "1" into cell A1 but 10 seconds after the button is pressed.

I'm looking for something like:

Private Sub CommandButton1_Click()
"10 seconds timer" (and then)
Range("a1") = 1
end sub

Cheers,

Craig

--
The Zero ST

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default Instruction Delay

Experiment with

For j=1 to 10000
' do nothing
Next j

Try bigger/smaller values for 10000. But be aware the delay will not be the
same on all machines.
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Craig Coope" wrote in message
...
IS it possible to program a button to do something simple, such as
input a "1" into cell A1 but 10 seconds after the button is pressed.

I'm looking for something like:

Private Sub CommandButton1_Click()
"10 seconds timer" (and then)
Range("a1") = 1
end sub

Cheers,

Craig

--
The Zero ST



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Instruction Delay

Or maybe:

application.wait now + timeserial(0,0,10)

The program just sits there and does nothing for 10 seconds.



Craig Coope wrote:

IS it possible to program a button to do something simple, such as
input a "1" into cell A1 but 10 seconds after the button is pressed.

I'm looking for something like:

Private Sub CommandButton1_Click()
"10 seconds timer" (and then)
Range("a1") = 1
end sub

Cheers,

Craig

--
The Zero ST


--

Dave Peterson
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
What Instruction? johnsail Excel Discussion (Misc queries) 3 March 9th 09 09:51 AM
How do I delete an instruction box? Priscilla Excel Worksheet Functions 2 June 24th 07 06:21 AM
LeftFooterPicture instruction does not appear to work Guackyxxx Excel Programming 4 November 16th 04 11:35 PM
BAR CODE Instruction Hmagallanes Excel Programming 7 February 17th 04 07:55 PM
The 'clear' instruction in VBA Mike[_65_] Excel Programming 2 February 8th 04 06:57 PM


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

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

About Us

"It's about Microsoft Excel"