LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default remove items from listbox together with add item

Hi ,
I try to create a user form which contains 1 listbox and i wrote a
code to add items to a list box which only entered today. But I want
also consider hours for those entry.So lets say if for today user can
also able to choose time frame(like from14:00 to 16:00 etc).I am only
thinking to add the items for that date then remove those items which
are not in that time frame. But I really stuck. Can any one give me a
hand or give me suggestions. my code for now as follows
By the way that code only for commandbutton, All the names set.
Private Sub UserForm_Initialize()
Set reqd = ThisWorkbook.Names("req").RefersToRange
End Sub
sub GetTheList()
Dim Cell As Range
Dim trddate As Variant
trddate = Date
For Each Cell In reqd.Columns(1).Cells
If Cell.Value = trddate Then
UserForm1.ListBox1.AddItem Cell.Offset(0, 1).Value
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCou nt - 1,
2) = Cell.Offset(0, 2)
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCou nt - 1,
3) = Cell.Offset(0, 3)
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCou nt - 1,
4) = Cell.Offset(0, 4)
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCou nt - 1,
5) = Cell.Offset(0, 5)
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCou nt - 1,
6) = Cell.Offset(0, 6)
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCou nt - 1,
7) = Cell.Offset(0, 7)
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCou nt - 1,
8) = Cell.Offset(0, 8)
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCou nt - 1,
9) = Format(Cell.Offset(0, 9), "hh:mm")
UserForm1.ListBox1.ColumnHeads = True
UserForm1.ListBox1.TextColumn = 9
End If
Next
end sub

 
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
Remove Item from Listbox by Item Name Randy[_2_] Excel Programming 3 September 19th 07 02:36 PM
Remove items from a listbox Andy Excel Programming 6 November 28th 06 12:45 AM
remove item fr listbox (correction) Baha Excel Programming 2 November 9th 06 01:11 AM
listbox remove Item Simon Shaw Excel Programming 3 July 3rd 05 10:14 PM
Remove all Listbox items Todd Huttenstine Excel Programming 3 July 12th 04 09:56 PM


All times are GMT +1. The time now is 02:51 PM.

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

About Us

"It's about Microsoft Excel"