I have a Userform with 1 Combobox and 10 Textboxes. I use this form to update fields on my sheet using this Textbox code;
ActiveCell.Offset(0, 1).Value = TextBox1.Value
I use the following code to clear the Combobox and Textbox data before i enter new data into them;
Dim ctl As Control
For Each ctl In UserForm1.Controls
If TypeName(ctl) = "TextBox" Then ctl.Value = Empty
If TypeName(ctl) = "ComboBox" Then ctl.Value = Empty
Next ctl
This delete code works well but has a strange side effect. It also deletes the data i just entered onto my sheet (all 10 columns of it). It only deletes the last line i entered.
What is causing this?
Thx,
Noir
ActiveCell.Offset(0, 1).Value = TextBox1.Value
I use the following code to clear the Combobox and Textbox data before i enter new data into them;
Dim ctl As Control
For Each ctl In UserForm1.Controls
If TypeName(ctl) = "TextBox" Then ctl.Value = Empty
If TypeName(ctl) = "ComboBox" Then ctl.Value = Empty
Next ctl
This delete code works well but has a strange side effect. It also deletes the data i just entered onto my sheet (all 10 columns of it). It only deletes the last line i entered.
What is causing this?
Thx,
Noir