Userform Canellation.

C

Corey

I am creating a userform with hlp from some other forum users.
I have just noticed that when a value is placed intop a textbox, or
combobox, the sheet that those values WILL be placed in from the userform
are being input in the background as typing of the values is carried out.

This is nopt a problem.(But thought application.screenupdating = false)
removes this, but If i need to cancel the userform via the Cancel
button(unload me),
I then have to nagivate to the sheet and manually clear the data the
userform was putting in the cells.

1. How do i prevent the data being placed into the sheet UNTIL the OK button
is clicked,
or

2. How do i have the data entered into the userform cleard from the sheet IF
i click cancel ?


Corey....
 
A

Abdul

Hi,

Please give us your code so we can clearly understand it.
if you are putting your code to transfer the data under the textbox or
combobox change event it will not write it your cell unless you press
your OK button.

If I have textbox1 and commandbuuton1 in a user form then
The value of textbox1 will be entered in sheet1 range A1 only when i
press the commandbutton1 using the following code

Private Sub CommandButton1_Click()
Sheets("Sheet1").Range("A1") = TextBox1.Value
End Sub


Thanks
 
B

Bob Phillips

Change your code to write to the sheet on an explicit action, such as
clicking a commanbutton, not as it is entered.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top