View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Userform/Textbox Issues

Hi Mastermind,

See John Walkenbach at:

Handle Multiple UserForm Buttons With One Subroutine
http://www.j-walk.com/ss/excel/tips/tip44.htm

John's technique can readily be adapted to your TextBoxes.


---
Regards,
Norman


"mastermind" wrote in message
ps.com...
I have a userform with a few textboxes, all of which run the same
code. I was wondering if there was a way to link them to the same
section of code. The code each one runs is below:

Private Sub TextBox1_Change()
If IsNumeric(TextBox1.Text) Then
If TextBox1.Value < 1 Or TextBox1.Value 12 Then
TextBox1.Value = Month(Date)
MsgBox "This box is intended to indicate the month and" &
_
vbCrLf & "will only accept values between 1 and 12"
End If
Else
TextBox1.Value = ""
End If
End Sub