Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
user forms | Excel Discussion (Misc queries) | |||
intermittent problem with clearing textboxes on forms | Excel Programming | |||
User Forms - Max Me | Excel Programming | |||
User forms | Excel Programming | |||
User forms in VBA | Excel Programming |