Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Closing UserForm

I am creating a diologue box by creating a UserForm. The UserForm
automatically has a close button (X). I want to be able to change the value
of a cell in the worksheet if that button is pushed. The problem is I can't
seem to find where to write the code, everything I have tried has not worked.


Please Help :)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Closing UserForm

Keri,
Try this: right click on Userform and "View Code"

Private Sub UserForm_Terminate()
MsgBox "Userform Closed"
' add code to update your cell

End Sub

"Keri" wrote:

I am creating a diologue box by creating a UserForm. The UserForm
automatically has a close button (X). I want to be able to change the value
of a cell in the worksheet if that button is pushed. The problem is I can't
seem to find where to write the code, everything I have tried has not worked.


Please Help :)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Closing UserForm

Use the QueryClose event of the userform. If the X button was
used to close the form, the CloseMode will be 0. If Unload is
used to dismiss the form, CloseMode will be 1. See help for
QueryClose for more details.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Keri" wrote in message
...
I am creating a diologue box by creating a UserForm. The
UserForm
automatically has a close button (X). I want to be able to
change the value
of a cell in the worksheet if that button is pushed. The
problem is I can't
seem to find where to write the code, everything I have tried
has not worked.


Please Help :)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Closing UserForm

Thanks that worked great :)

"Toppers" wrote:

Keri,
Try this: right click on Userform and "View Code"

Private Sub UserForm_Terminate()
MsgBox "Userform Closed"
' add code to update your cell

End Sub

"Keri" wrote:

I am creating a diologue box by creating a UserForm. The UserForm
automatically has a close button (X). I want to be able to change the value
of a cell in the worksheet if that button is pushed. The problem is I can't
seem to find where to write the code, everything I have tried has not worked.


Please Help :)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform won't show after closing another file Gerry O Excel Discussion (Misc queries) 8 September 7th 07 03:51 PM
closing userform automatically Jim Brass Excel Programming 1 September 5th 05 03:39 PM
closing a userform mangesh_yadav[_50_] Excel Programming 5 August 31st 04 02:26 PM
Vba - automaticaly closing userform ajliaks[_30_] Excel Programming 1 August 22nd 04 09:53 AM
Help with closing a UserForm Ron de Bruin Excel Programming 0 August 8th 03 01:52 PM


All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"