Ask Your Question

How can I conditionally prevent a macro from running in calc

asked 2018-12-09 06:59:57 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I have a button-linked Macro that does a month-end calculation when closing a monthly ledger page. However, once the month is "closed", I want that button to be non-functioning. My thought is to use a cell that, if False would allow the macro to run but if True would abort the call. I'm thinking that an If, Then, Else condition would work but I am at a loss as to the proper syntax/commands to make the condition work. Any thoughts or suggestions would be appreciated.

edit retag flag offensive close merge delete


Don't post questions as wiki. Only disadvantages.

Lupp gravatar imageLupp ( 2018-12-09 09:35:12 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-12-09 07:07:41 +0200

Ratslinger gravatar image


At the beginning of the sub, retrieve the cell string. Then in an if statement:

If cellData = "True" Then Exit Sub
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-12-09 06:59:57 +0200

Seen: 38 times

Last updated: Dec 09 '18