View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Cancel Button in User Form does not rever to original state

No, it just fires the event you program to take the actions you want.

So in the Initialize event, gather the values in the cells and store them in
a module level variable(s). In the cancel event, restore those values by
writing them back to the cells (or work with the checkboxes - your choice.

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
I have a User Form with five check boxes. The default setting for the
check boxes is FALSE.

When I open the user form and select some of them and then hit the
CANCEL commandbutton (the idea being that I dont want to make any
changes afterall), the cells chosen as the ControlSoruce retain the
TRUE value.

What I want it to do is for it to return to the state the check boxes
had when the User Form was open - whether that be TRUE or FALSE.
While the default state is false, in some cases selections may have
been made previously.

The code associated to the Cancel Button is:

Private Sub cb_Cancel_Click()

Unload Me

End Sub

I thought that this was the code to use to achieve cancel any actions
taken on a user form. Obviously not.

What do I need to do?

Thank you.