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.
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.
arcq
have the 1st part of you macro test for the condtions required. If they are not correct exit sub
example
sub Macro1
if range("a1").value <> range("b1").value then
msgbox "Missing Data in A1"
exit sub
end if
your code here
end sub
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.
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks