ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Load User form (https://www.excelbanter.com/excel-programming/447433-load-user-form.html)

Bakar

Load User form
 
Hi everyone
I have already designed user form
there is a text box and Button ok and button cancel
Already assign the text box to cellA1
Now I load it enter the value in the text box and already see in cell A1
but when I click the ok button the form remain on the screen and when i cancel it it disappear now i load it again the value still in the text box
What I want is(A) I click to open the user form (B) I insert the value (C)
I click ok the value transfer to cellA1 and the userform close and when i reopen it the text box is empty

Thnxs for help

Bakar

Claus Busch

Load User form
 
Hi Bakar,

Am Fri, 19 Oct 2012 10:30:38 +0000 schrieb Bakar:

What I want is(A) I click to open the user form (B) I insert the value
(C)
I click ok the value transfer to cellA1 and the userform close and when
i reopen it the text box is empty


you can show the userform by double clicking in your sheet. Put
foolwoing code in the code module of your sheet:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
UserForm1.Show
Cancel = True
End Sub

and for your OK button, use:

Private Sub cmdOK_Click()
[A1] = TextBox1.Text
Unload UserForm1
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


All times are GMT +1. The time now is 11:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com