Hi
I have a Listbox with 2 columns. I am populating the Listbox from a named range and this works fine.
When the user clicks on one of the rows of the Listbox an Input Box appears asking the user to enter a date. When they enter the date I would like the date to appear in column 2 of the List Item they clicked. Here is my code so far...
Initialize
Clicking the ListBox
I have a Listbox with 2 columns. I am populating the Listbox from a named range and this works fine.
When the user clicks on one of the rows of the Listbox an Input Box appears asking the user to enter a date. When they enter the date I would like the date to appear in column 2 of the List Item they clicked. Here is my code so far...
Initialize
Code:
Private Sub UserForm_Initialize()
Dim TaskInt As Integer
Me.list_Tasks.RowSource = "Task_List"
Dim i As Integer
Dim TaskVal As Range
Dim TaskName As String
TaskInt = 1
i = 0
Do Until TaskInt = list_Tasks.ListCount + 1
TaskName = list_Tasks.List(i)
Set TaskVal = ActiveCell.Find(What:=TaskName)
If TaskVal Is Nothing Then 'If the number isnt found
i = i + 1
Else
list_Tasks.Selected(i) = True
i = i + 1
End If
TaskInt = TaskInt + 1 'Increment the Task Int by 1
Loop
End Sub
Clicking the ListBox
Code:
Private Sub list_Tasks_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim TaskDate As Date
i = Me.list_Tasks.ListIndex
If list_Tasks.Selected(i) = True Then
TaskDate = InputBox("Enter a date for the task", "Task Date", VBA.Format(Now(), "dd/mm/yyyy"))
[B][COLOR=#ff0000] 'WHAT DO I PUT HERE TO PASS TaskDate to the Listbox ??????
[/COLOR][/B]
End If
End Sub