Excel VBA: if a cell not empty, then freeze or lock (do not allow to change) another cell

Copper Contributor

Hi Everybody!

I have az excel file with a macro.

When I select a type in cell G8, then macro will run. Then other people have to fill the table....

But in case someone change the selection of type in cell G8, then the marco will run.

I would like to add a lock. If I add any comment to A1 cell, then G8 Cell should be freezed, locked or the macro should not run again. Only when A1 is empty.


Any ideas?


3 Replies
best response confirmed by depedro11 (Copper Contributor)
Just add that condition to the macro. First line of the macro would be something like
IF activesheet.range("A1")<>"" then exit sub