Quote Originally Posted by av8tordude
not sure what you mean...apply the same code in the exit event? I'll get an error.
I meant the exit event of the textbox. In a new/blank workbook, create a userform with three textboxes.
[vba]Option Explicit

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim MeCtl As MSForms.TextBox
Set MeCtl = Me.ActiveControl
TrimLeft MeCtl
Me.Caption = ">" & MeCtl.Value & "<"
End Sub

Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim MeCtl As MSForms.TextBox
Set MeCtl = Me.ActiveControl
TrimLeft MeCtl
Me.Caption = ">" & MeCtl.Value & "<"
End Sub

Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim MeCtl As MSForms.TextBox
Set MeCtl = Me.ActiveControl
TrimLeft MeCtl
Me.Caption = ">" & MeCtl.Value & "<"
End Sub

Private Function TrimLeft(ByRef tb As MSForms.TextBox)
tb.Value = LTrim(tb.Value)
End Function[/vba]
You can watch the userform's caption to see that the values entered into whichever textbox are trimmed on the left (leading spaces) upon exiting the textbox.

What exactly are you wanting to do? I ask as I would suspect that trimming in the textbox is not the issue. Wouldn't we be more likely be concerned with what is happening with the textbox's value as it affects other parts of the code (ie - the val stored in the variable). I hope that makes sense.

Mark