groovedude
New Member
- Joined
- Jan 28, 2014
- Messages
- 5
Hi everyone,
Right I am rather new to VBA so I am currently in the process of educating myself and I am hoping you guys can steer me in the right direction.
I have built a data entry form in VBA however I would like to add some additional functions, I would like to have the ability to navigate through existing records and to amend them.
In ideal world I would like to navigate them based on owner, for example you select an owner then you can browse all records where they exist.
Right I am rather new to VBA so I am currently in the process of educating myself and I am hoping you guys can steer me in the right direction.
I have built a data entry form in VBA however I would like to add some additional functions, I would like to have the ability to navigate through existing records and to amend them.
In ideal world I would like to navigate them based on owner, for example you select an owner then you can browse all records where they exist.
Code:
Private Sub ComboAssociated_Enter()
'Populate control.
Me.ComboAssociated.AddItem "Project 1"
Me.ComboAssociated.AddItem "Project 2"
Me.ComboAssociated.AddItem "Project 3"
Me.ComboAssociated.AddItem "Project 4"
End Sub
Private Sub ComboChangeType_Enter()
'Populate control.
Me.ComboChangeType.AddItem "Change 1"
Me.ComboChangeType.AddItem "Change 2"
Me.ComboChangeType.AddItem "Change 3"
Me.ComboChangeType.AddItem "Change 4"
End Sub
Private Sub ComboOwner_Enter()
'Populate control.
Me.ComboOwner.AddItem "User 1"
Me.ComboOwner.AddItem "User 2"
Me.ComboOwner.AddItem "User 3"
Me.ComboOwner.AddItem "User 4"
Me.ComboOwner.AddItem "User 5"
End Sub
Private Sub cmdAdd_Enter()
'Copy input values to sheet.
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Raw")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(lRow, 1).Value = Me.ComboChangeType.Value
.Cells(lRow, 2).Value = Me.ComboAssociated.Value
.Cells(lRow, 3).Value = Me.txtTitleofChange.Value
.Cells(lRow, 4).Value = Me.ComboOwner.Value
.Cells(lRow, 5).Value = Me.TextStart.Value
.Cells(lRow, 6).Value = Me.TextFinish.Value
End With
'Clear input controls.
Me.ComboChangeType.Value = ""
Me.ComboAssociated.Value = ""
Me.txtTitleofChange.Value = ""
Me.ComboOwner.Value = ""
Me.TextStart.Value = ""
Me.TextFinish.Value = ""
End Sub
Private Sub cmdClose_Click()
'Close UserForm.
Unload Me
End Sub