activate/deactivate button with macro at given condition

  • Thread starter Thread starter arcq
  • Start date Start date
A

arcq

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top