Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Clearing user forms

I've made a simple user form consisting of 3 input text
boxes. After inputting values, a command button is clicked
and the user form closes and populates 3 cells in a
worksheet with the values.

I have another command button (from the forms menu) on the
worksheet that will clear the inputted data and re-load
the user form ready for another input.

At the moment the user form reloads but the previous
values are still there. The following code is used: -

Private Sub commandbutton32()
Sub button32_Click()
Range("a1").ClearContents
Range("a2").ClearContents
Range("f3").ClearContents
Range("f5").ClearContents
Range("f9").ClearContents
UserForm1.Show

End Sub

How can I get the user userform to reload with blank text
boxes?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Clearing user forms

anthony, something like this

UserForm1.TextBox1.Value = ""
UserForm1.TextBox2.Value = ""
UserForm1.TextBox3.Value = ""
Unload UserForm1
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **

"anthony slater" wrote in message
...
I've made a simple user form consisting of 3 input text
boxes. After inputting values, a command button is clicked
and the user form closes and populates 3 cells in a
worksheet with the values.

I have another command button (from the forms menu) on the
worksheet that will clear the inputted data and re-load
the user form ready for another input.

At the moment the user form reloads but the previous
values are still there. The following code is used: -

Private Sub commandbutton32()
Sub button32_Click()
Range("a1").ClearContents
Range("a2").ClearContents
Range("f3").ClearContents
Range("f5").ClearContents
Range("f9").ClearContents
UserForm1.Show

End Sub

How can I get the user userform to reload with blank text
boxes?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clearing user forms


When you close the userform, how are you doing it? If you us
UserForm1.Hide, then that's the problem. You would probably want t
use Unload UserForm1.

If that's not the problem, is there anything in the Userform_Activat
or UserForm_Initialize event that pre-populates the text boxes wit
values from the sheet? If so, you would want to stop doing that...



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26729

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Clearing user forms

When you close the userform unload it rather than hide it

Unload Userform1

rather than

Userform1.Hide

--
Regards,
Tom Ogilvy

"anthony slater" wrote in message
...
I've made a simple user form consisting of 3 input text
boxes. After inputting values, a command button is clicked
and the user form closes and populates 3 cells in a
worksheet with the values.

I have another command button (from the forms menu) on the
worksheet that will clear the inputted data and re-load
the user form ready for another input.

At the moment the user form reloads but the previous
values are still there. The following code is used: -

Private Sub commandbutton32()
Sub button32_Click()
Range("a1").ClearContents
Range("a2").ClearContents
Range("f3").ClearContents
Range("f5").ClearContents
Range("f9").ClearContents
UserForm1.Show

End Sub

How can I get the user userform to reload with blank text
boxes?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Clearing user forms

I tried the code given below but when the userform is reloaded, the old
values are still there.

Do I put this code in the module or in the userform section?

Sorry about this but fairly new to VB



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
user forms Obi-Wan Kenobi Excel Discussion (Misc queries) 0 March 21st 06 08:28 PM
intermittent problem with clearing textboxes on forms Renae[_2_] Excel Programming 0 October 7th 04 03:57 AM
User Forms - Max Me Dave Peterson[_3_] Excel Programming 0 June 26th 04 04:22 AM
User forms eklarsen[_4_] Excel Programming 2 May 6th 04 06:09 PM
User forms in VBA Dick Kusleika Excel Programming 0 September 29th 03 05:55 PM


All times are GMT +1. The time now is 12:09 AM.

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

About Us

"It's about Microsoft Excel"