View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jacob Jacob is offline
external usenet poster
 
Posts: 61
Default closng userform and canceling changes

thanks for the help.

John wrote:
Ah, didn't know that one. Much simpler!

Thanks Rob

"Robert Bruce" <rob@analytical-dynamicsdotcodotukay wrote in message
...
Roedd <<John wedi ysgrifennu:

Hi Jacob,

I would split up the functionality a little cleanup code on each
button click event. So for example:

Private Sub UserForm_Initialize()
Call SetDefaultSettings
End Sub

Private Sub cmdOK_Click()
'Add values to workbook code
Call SetDefaultSettings
Me.Hide
End Sub

Private Sub cmdCancel_Click()
'Ignore add values to workbook code
Call SetDefaultSettings
Me.Hide
End Sub

Private Sub SetDefaultSettings()
Me.chkBox1.Value = False
'Plus other changes you want to make
End Sub


Or just call SetDefaultSettings from Userform_activate which will run
every
time the form is unhidden.

Rob