![]() |
Text Box Enter and Exit Events
I am writing code in which I want to check the text value of a text box upon
the exit from a text box against the value that was there upon the Enter event. I seem to be having a problem passing this variable from the Enter event procedure to the Exit event procedure. Anything obvious I'm missing? Also, is there a better way to do what I'm trying? |
Text Box Enter and Exit Events
Try something like......
' at top of userform code module Dim TextBefore As String Private Sub TextBox1_Enter() TextBefore = Trim(TextBox1.Value) End Sub Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If Trim(TextBox1.Value) = TextBefore Then MsgBox "No Change" Else MsgBox "Changed" End If End Sub Private Sub UserForm_Initialize() TextBefore = Trim(TextBox1.Value) End Sub -- Regards, Nigel "dunnerca" wrote in message ... I am writing code in which I want to check the text value of a text box upon the exit from a text box against the value that was there upon the Enter event. I seem to be having a problem passing this variable from the Enter event procedure to the Exit event procedure. Anything obvious I'm missing? Also, is there a better way to do what I'm trying? |
All times are GMT +1. The time now is 06:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com