Sub TextBox1_Change()
call MyTest
End Sub
Sub TextBox2_Change()
call MyTest
End Sub
Sub TextBox3_Change()
call MyTest
End Sub
...
Sub TextBox20_Change()
call MyTest
End Sub
Sub MyTest()
' How do I know the object? its value? etc etc
if ?????.text = "whatever" then DoSomething
End Sub
Form controls (although I will appreciate answer for Active-X also)Are your TextBoxes on a Sheet, or Form? Are they ActiveX, or Form Controls?
Private Sub Text1_sub()
Call MyTest()
End Sub
Private Sub Text2_sub()
Call MyTest()
End Sub
Private Sub Text3_sub()
Call MyTest()
End Sub
Private Sub Text4_sub()
Call MyTest()
End Sub
...
Private Sub Text20_sub()
Call MyTest()
End Sub
Private Sub MyTest()
' Here I need to access say CurrentField.Text CurrentField.BackColor CurrentField.ForeColor .... etc etc so I need CurrentField
' if it were a cell I would use ActiveCell, but I don't know what to use for a Form Field
End Sub[/COLOR]
Private Sub TextBox1_Change()
Dim tbName As String, aCell As Range
Set aCell = ActiveCell
tbName = Me.ActiveControl.Name
Me.MyTest aCell, tbName
End Sub
Private Sub TextBox2_Change()
Dim tbName As String, aCell As Range
Set aCell = ActiveCell
tbName = Me.ActiveControl.Name
Me.MyTest aCell, tbName
End Sub
Sub MyTest(ByVal cell As Range, ByVal tb As String)
Dim sht As Worksheet
Set sht = ActiveSheet
MsgBox "Current ActiveCell is " & sht.Name & "!" & cell.Address & " and, the current TextBox is " & tb & ".", vbInformation, "Info Show"
End Sub
Sub FormPullTest()
BlankForm.Show
Unload BlankForm
End Sub