Forum Discussion

depedro11's avatar
depedro11
Copper Contributor
Jan 13, 2022
Solved

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

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?

Thanks

  • Just add that condition to the macro. First line of the macro would be something like
    IF activesheet.range("A1")<>"" then exit sub

3 Replies

  • mtarler's avatar
    mtarler
    Silver Contributor
    Just add that condition to the macro. First line of the macro would be something like
    IF activesheet.range("A1")<>"" then exit sub

Resources