Issue with textbox_exit event

thorpyuk

Well-known Member
Joined
Mar 14, 2006
Messages
1,453
Hiya,

I've a userform with a textbox that allows me to pop in a comment.

I save what i write in the textbox back to my data sheet by using:

Code:
Private Sub TextBox35_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If blnHaltChange Then Exit Sub
If IsError(Application.Match(Val(TextBox1.Text), Worksheets("Project").Range("A:A"), 0)) Then Exit Sub
Sheets("Project").Range("AM" & f.Row).Value = TextBox35.Value
End Sub

However, i have a combobox that lets me select different records, and when i choose a different record, this does not trigger my exit event, and my comment is lost.


I tried putting Textbox44_Exit in my combobox change code, but it didn't like that.... has anyone any other ideas how i might force my exit event?

Thanks!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
The Exit event should fire as soon as you click on the combobox if you were in the textbox. Are you sure your blnhaltchange variable isn't set to True?
(I don't see where Textbox44 comes into it at all)
 
Upvote 0
Oops, yes i meant i tried Textbox35_Exit and that didn't work...

Nope, blnhaltchange is definitely set to false, but the exit event isn't firing when clicking the combobox :/

It works if i click off the textbox, or click on my exit button :/

I am setting the bln indicator to true immediately using combobox3_click.

would this fire before textbox35_exit?

Code:
Private Sub ComboBox3_Click()
If blnHaltChange Then Exit Sub

blnHaltChange = True
On Error Resume Next
 
Upvote 0
Still cant figure this rat out!

I've tried moving my code to the change event rather than the click event, but i'm sure that the exit event for my textbox would always go before both of those :/

Does anyone have any ideas at all? :/
 
Upvote 0
hi

couldn't you use

Code:
private sub textbox35_afterupdate()

'your code here

end sub

as the event?
 
Upvote 0
Have you tried putting a breakpoint on the first line of the textbox exit event just to check if it is even trying to fire?
 
Upvote 0

Forum statistics

Threads
1,216,219
Messages
6,129,575
Members
449,519
Latest member
Rory Calhoun

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top