View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Validation subroutine for textboxes

Pass the textbox itself.

Private Sub txtOverallForward_Change()
CheckRange Me.txtOverallForward
End Sub

Sub CheckRange(TBox as msforms.textbox)
msgbox TBox.value
end sub



chemicals wrote:

I hav a Userform with 24 textboxes on it. I would like to call a generic
validation routine on each change event. My problem is how do I generically
reference the control's value in the Change event routine ?

Here's what I am trying to do:

Private Sub txtOverallForward_Change()
CheckRange (Me.txtOverallForward.Value)
End Sub

but is there a way to do something like:
Private Sub txtOverallForward_Change()
CheckRange (Me.ActiveControl.Value) <-------
End Sub


--

Dave Peterson