Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Click event to run only once


HI again,

I apologise for my persistence but im really stuck!! Can someone sho
me how to apply so that my click event runs only once??

Thanks in advance!

--
gavme
-----------------------------------------------------------------------
gavmer's Profile: http://www.excelforum.com/member.php...nfo&userid=666
View this thread: http://www.excelforum.com/showthread.php?threadid=26497

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Click event to run only once

One way to do it is to use a Static variable, so it
retains its value between calls. If you use a Boolean,
you can use it to flag when the sub has been run
previously, and if so to abort processing the code; e.g:

Sub Button1_Click()

Static Pressed As Boolean

If Not(Pressed) Then

' Insert your code here

End If

Pressed = True

End Sub

First time this is run, Pressed starts out false so your
code runs. But then Pressed is set to True and the value
is retained between calls - so next time it will fail the
IF statement and the code will be bypassed.

K Dales

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

HI again,

I apologise for my persistence but im really stuck!! Can

someone show
me how to apply so that my click event runs only once??

Thanks in advance!!


--
gavmer
----------------------------------------------------------

--------------
gavmer's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=6662
View this thread:

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

.

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
Click event to run only once gavmer[_85_] Excel Programming 0 October 5th 04 12:18 AM
Click event to run only once gavmer[_83_] Excel Programming 0 October 1st 04 01:24 AM
Click event to run only once gavmer[_82_] Excel Programming 1 September 30th 04 12:42 PM
Before Right Click event mohsinb[_8_] Excel Programming 10 December 22nd 03 08:47 AM
Click Event Nichevo Excel Programming 2 December 4th 03 04:31 AM


All times are GMT +1. The time now is 11:22 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"