Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Lizzie_S
 
Posts: n/a
Default Need help with Listbox

Hi Everyone,

In my spreadsheet, I have the following choices in G4 to G54.
Not Started
In Progress
Completed

And from H4 to H54, It contains the date when the tasks should be completed.
e.g. 7/27/2005
8/15/2005

From C4 to C54, I have a list of tasks.


I have added a form and 2 listboxes. On the first listbox, i want to show
all the tasks overdue, and on the 2nd listbox i want to show all the tasks
that are still on schedule. And i dont know how to do it.

To determine if the task is overdue, the status is not started, in progress
and exceeds to the date of completion otherwise it should fall on listbox2.


Please help.

Thanks in advance

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

You should use the advanced filter to create separate ranges of data that
match your criteria, and then link the listbox to these ranges.

--
HTH

Bob Phillips

"Lizzie_S" wrote in message
...
Hi Everyone,

In my spreadsheet, I have the following choices in G4 to G54.
Not Started
In Progress
Completed

And from H4 to H54, It contains the date when the tasks should be

completed.
e.g. 7/27/2005
8/15/2005

From C4 to C54, I have a list of tasks.


I have added a form and 2 listboxes. On the first listbox, i want to show
all the tasks overdue, and on the 2nd listbox i want to show all the tasks
that are still on schedule. And i dont know how to do it.

To determine if the task is overdue, the status is not started, in

progress
and exceeds to the date of completion otherwise it should fall on

listbox2.


Please help.

Thanks in advance



  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

I put two listboxes and a button on a userform and put this behind the userform:

Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()

Dim myCell As Range
Dim myRng As Range

With Worksheets("sheet1")
Set myRng = .Range("g4", .Cells(.Rows.Count, "G").End(xlUp))
End With

For Each myCell In myRng.Cells
If myCell.Offset(0, 1).Value = Date Then
'do nothing, not due/overdue
Else
If LCase(myCell.Value) = "completed" Then
Me.ListBox1.AddItem myCell.Offset(0, -4).Value
Else
Me.ListBox2.AddItem myCell.Offset(0, -4).Value
End If
End If
Next myCell
End Sub

========
Although, I think I would take a different approach.

I'd use a helper column of cells:
=IF(G4="completed","",IF(H4=TODAY(),"","Overdue") )
and drag down the data

Then I could apply Data|Filter|Autofilter and see lots of stuff all at once
(instead of through the "eyes" of a userform's listbox.

ps.

I wasn't sure what happened on today. If it's due today, is it overdue or just
ontime.

Change the = to what you want (in both the code and formula).

Lizzie_S wrote:

Hi Everyone,

In my spreadsheet, I have the following choices in G4 to G54.
Not Started
In Progress
Completed

And from H4 to H54, It contains the date when the tasks should be completed.
e.g. 7/27/2005
8/15/2005

From C4 to C54, I have a list of tasks.

I have added a form and 2 listboxes. On the first listbox, i want to show
all the tasks overdue, and on the 2nd listbox i want to show all the tasks
that are still on schedule. And i dont know how to do it.

To determine if the task is overdue, the status is not started, in progress
and exceeds to the date of completion otherwise it should fall on listbox2.

Please help.

Thanks in advance


--

Dave Peterson
  #4   Report Post  
Lizzie_S
 
Posts: n/a
Default

Thanks Dave! The code is very helpful. You're great.

"Dave Peterson" wrote:

I put two listboxes and a button on a userform and put this behind the userform:

Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()

Dim myCell As Range
Dim myRng As Range

With Worksheets("sheet1")
Set myRng = .Range("g4", .Cells(.Rows.Count, "G").End(xlUp))
End With

For Each myCell In myRng.Cells
If myCell.Offset(0, 1).Value = Date Then
'do nothing, not due/overdue
Else
If LCase(myCell.Value) = "completed" Then
Me.ListBox1.AddItem myCell.Offset(0, -4).Value
Else
Me.ListBox2.AddItem myCell.Offset(0, -4).Value
End If
End If
Next myCell
End Sub

========
Although, I think I would take a different approach.

I'd use a helper column of cells:
=IF(G4="completed","",IF(H4=TODAY(),"","Overdue") )
and drag down the data

Then I could apply Data|Filter|Autofilter and see lots of stuff all at once
(instead of through the "eyes" of a userform's listbox.

ps.

I wasn't sure what happened on today. If it's due today, is it overdue or just
ontime.

Change the = to what you want (in both the code and formula).

Lizzie_S wrote:

Hi Everyone,

In my spreadsheet, I have the following choices in G4 to G54.
Not Started
In Progress
Completed

And from H4 to H54, It contains the date when the tasks should be completed.
e.g. 7/27/2005
8/15/2005

From C4 to C54, I have a list of tasks.

I have added a form and 2 listboxes. On the first listbox, i want to show
all the tasks overdue, and on the 2nd listbox i want to show all the tasks
that are still on schedule. And i dont know how to do it.

To determine if the task is overdue, the status is not started, in progress
and exceeds to the date of completion otherwise it should fall on listbox2.

Please help.

Thanks in advance


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Excel ActiveX listbox controls programmer123 Excel Discussion (Misc queries) 0 July 7th 05 10:30 PM
multiple columns / rows to be referenced through a listbox Hru48 Excel Discussion (Misc queries) 0 July 4th 05 04:12 PM
Help! Activate worksheet from a listbox Bob Phillips Excel Worksheet Functions 0 May 18th 05 09:09 AM
Listbox Question Greg B Excel Discussion (Misc queries) 0 March 9th 05 12:46 AM
How do I return the unique entries from a column to a listbox Dave Mc Excel Worksheet Functions 4 February 9th 05 08:02 AM


All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"