RobbieC
Active Member
- Joined
- Dec 14, 2016
- Messages
- 376
- Office Version
- 2010
- Platform
- Windows
Hi there, I have a userform with 100 text fields on it. they are all named dp1 dp2 dp3.... dp99 dp100
when I enter a text field I want the backcolor to change to green and the text white. and upon exiting revert to backcolor white and black text... I can do this using this code:
but is there a way to do a 'catch all' bit of code, or do I have to manually enter this code for all 100 text fields?
If you can point me in the right direction, I'd be very happy.
Thanks
Rob
when I enter a text field I want the backcolor to change to green and the text white. and upon exiting revert to backcolor white and black text... I can do this using this code:
Code:
Private Sub dp1_enter()
Me.dp1.BackColor = &H8000&
Me.dp1.ForeColor = &HFFFFFF
End Sub
Private Sub dp1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.dp1.BackColor = &HFFFFFF
Me.dp1.ForeColor = &H80000008
End Sub
but is there a way to do a 'catch all' bit of code, or do I have to manually enter this code for all 100 text fields?
If you can point me in the right direction, I'd be very happy.
Thanks
Rob
Last edited: