Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default activate/deactivate button with macro at given condition

is there a way for me to activate/deactivate a button with an assigned
macro of a given condition? like, a macro can only run when value of
two cells are equal. this is to avoid running the macro if the data is
not correct.

thank you very much.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default activate/deactivate button with macro at given condition

You could just do some validation at the start of your macro something along
the lines of:

If Cells(1, 1).Value < Cells(1, 2).Value Then
Exit Sub
Else
'Do all of
'this stuff
End If

You would probably also want to check that the two cells were not both empty
(which would mean their value properties would be the same).

Regards
Rowan


"arcq" wrote:

is there a way for me to activate/deactivate a button with an assigned
macro of a given condition? like, a macro can only run when value of
two cells are equal. this is to avoid running the macro if the data is
not correct.

thank you very much.


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
activate/deactivate macro depending on who's the user anna Excel Discussion (Misc queries) 3 January 24th 10 11:11 PM
Links is in gray color (deactivate). How can I activate? Rechie Excel Discussion (Misc queries) 6 December 13th 09 11:10 AM
button in a cell to activate a macro alexfair Excel Worksheet Functions 6 May 30th 08 03:09 PM
Macro to activate form button kkknie[_90_] Excel Programming 1 May 11th 04 08:31 PM
Activate / Deactivate mouse move event Rolo[_3_] Excel Programming 2 January 29th 04 01:50 PM


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