Hello,
I have a ListBox1 that is populated with Dates.
I want to be able to assign a macro to a CommandButton that selects Quarter 1 dates for 2013. I wrote something like this:
Private Sub CommandButton1_Click()
For I = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(I) = Year(ListBox1.List(I)) = 2013 Then
ListBox1.Selected(I) = Month(ListBox1.List(I)) = 1
ListBox1.Selected(I) = Month(ListBox1.List(I)) = 2
ListBox1.Selected(I) = Month(ListBox1.List(I)) = 3
End If
Next I
End Sub
It doesn't error, it just doesn't work. The code should select all values in the ListBox1 1/1/2013-3/31/2013
I don't understand how to select a YEAR & MONTH to run through a loop and select.
Bookmarks