It appears that you are using a Forms checkbox (instead of an ActiveX checkbox). My personal opinion is that the best way to do this is to link the checkbox to a cell (right-click on the checkbox, Control tab, fill in Cell Link), then check to see if that cell is True or False in this macro. Note that the same macro is called if you click on the checkbox, regardless of whether you are checking it or unchecking it. So the same macro has to do both jobs.
But beyond that, undoing an action means that you have to save the prior value of this cell somewhere. You should identify a cell someplace to save the value before you change it. Also note that if cell D1 is changed anywhere but in this code, such as by the user, you are going to need a more complex solution than this.
Let's say you link the checkbox to L1 (L for Link). And you use S1 to save the value (S for save).
Please note that I have compiled but not tested this, so it is just an example to illustrate the concept. If we're both lucky it will work.
Bookmarks