LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable a macrobutton for a particular cell change?


Ok, I have solved it myself. *If there is a better method please tell me
guys*.

Also, I preferred to use a custom toolbar.

I added the following code to my *Retrieve *button:

'This stores the retrieved date in a distant cell(in my case it is
AF5:AH5)
'I have named the cells containing date as Date, Month & Year

With Sheets("Master")
..Range("AF5") = Range("Date")
..Range("AG5") = Range("Month")
..Range("AH5") = Range("Year")
End With

Then I added the following code to the *worksheet_calculate *event
procedu

If Range("Date") < Range("AF5") Or Range("Month") < Range("AG5") Or
Range("Year") < Range("AH5") Then
Application.CommandBars("My Tool Bar").Controls("Store").Enabled =
False
Else
Application.CommandBars("My Tool Bar").Controls("Store").Enabled =
True
End If

So, if the retrieved date does not match with the change in
calendar(which happens when the user changes the date) the *store
*button is disabled and the user will not click it accidentally and
spoil the database.
It is working fine for me.


--
lotus
------------------------------------------------------------------------
lotus's Profile: http://www.excelforum.com/member.php...o&userid=23759
View this thread: http://www.excelforum.com/showthread...hreadid=493216

 
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
disable brian baulsom's worksheet change based on cell value. jat Excel Worksheet Functions 2 April 22nd 09 07:16 AM
how to disable listbox change event Tom Ogilvy Excel Programming 0 July 27th 04 05:55 PM
Enable/Disable Worksheet Change Event code Stuart[_5_] Excel Programming 2 November 3rd 03 07:22 PM
Disable Change Event in Form No Name Excel Programming 5 October 31st 03 08:23 PM
Disable Worksheet change event Tim[_14_] Excel Programming 4 July 15th 03 01:27 AM


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