Rogerant79
New Member
- Joined
- Oct 14, 2020
- Messages
- 5
- Office Version
- 2019
- Platform
- Windows
Hello,
first of all I congratulate you on the forum. It is one of the best in the world right now
Let's get to the point:
I would like to create a Userform as shown:
Essentially we have 3 objects:
I create these objects through this code inside the UserForm:
Here's my problem:
I want that if, for example, I insert the date in a textbox and the time in the adjacent texbox, I would like that if these 2 fields are complete, the checkbox of the same row will automatically become selected.
Can someone help me?
Thank you
first of all I congratulate you on the forum. It is one of the best in the world right now
Let's get to the point:
I would like to create a Userform as shown:
Essentially we have 3 objects:
- CheckBox
- TextBox (DATE)
- TextBox (TIME)
I create these objects through this code inside the UserForm:
VBA Code:
Option Explicit
Private Sub UserForm_Initialize()
Dim ID As msforms.CheckBox
Dim DAY As msforms.TextBox
Dim TIME As msforms.TextBox
Dim i As Long
For i = 1 To 10
' CheckBox creation
Set ID = UserForm1.Controls.Add("Forms.CheckBox.1")
With ID
.Name = "ID_index" & i
.Left = 20
.top = 25 + 22 * i
.Height = 18
.Width = 20
End With
' TextBox DAY creation
Set DAY = UserForm1.Controls.Add("Forms.TextBox.1")
With DAY
.Name = "DAY_index" & i
.Left = 50
.top = 25 + 22 * i
.Height = 18
.Width = 100
End With
' TextBox TIME creation
Set TIME = UserForm1.Controls.Add("Forms.TextBox.1")
With TIME
.Name = "TIME_index" & i
.Left = 160
.top = 25 + 22 * i
.Height = 18
.Width = 100
End With
Next i
End Sub
Here's my problem:
I want that if, for example, I insert the date in a textbox and the time in the adjacent texbox, I would like that if these 2 fields are complete, the checkbox of the same row will automatically become selected.
Can someone help me?
Thank you