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: 3
Default Selecting dates from ListBoxes by using RefEdit Control

Hello to all

I've a UserForm that contains 2 Listboxes:
- lbxData is a multicolumn listbox that contains data passed from a
RefEdit control.
- lbxSelectDate is a one column listbox that has Dates passed from the
3rd column of the RefEdit control.
My questions a

a)The code for adding the dates in lbxSelectDate is the following:
Private Sub AddDates()
Dim cell as Range, AllCellsDate as Range
Dim UniqueDates as New Collection
Set AllCellsDate = ("C3:C1000")
On Error Resume Next
For Each cell In AllCellsDate
If IsDate(cell.Value) Then
UniqueDates.Add cell.Value, CStr(cell.Value)
Else
Exit For
End If
Next cell
For Each Item In UniqueDates
UserForm1.lbxSelectDate.AddItem Item
Next Item
End Sub

Although this is working quite well I would prefer to have a code that
relates AllCellsDate with the RefEdit control (I want to use the third
column, from rows 3 to the last). Is there a way to access the 3rd
column of the RefEdit control?


b) After having the unique dates passed to the lbxSelectDate I want
the user to be able to choose dates (it's a multiselect extended list
box) so that subsequently the appropriate checkboxes in the lbxData
(the main list box) to be selected automatically. Furthermore, when a
date is not highlighted any more I would like the corresponding boxes
to be unchecked. The code that I came up so far is the following but
it doesn't work at all. Can anyone help me?

Private Sub lbxSelectDate_Click()
Dim r As Integer
If lbxSelectDate.Value = True Then
For r = 0 To lbxData.ListCount - 1
If CDate(lbxData.List(r, 2)) = lbxSelectDate.Value Then
lbxData.Selected(r) = True
End If
If CDate(lbxData.List(r, 2)) < lbxSelectDate.Value Then
lbxData.Selected(r) = False
End If
Next r
End If
End Sub


Many thanks in advance for your suggestions and sorry for the lengthy
request
 
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
start and end dates within listboxes casey Excel Worksheet Functions 4 April 16th 08 06:48 PM
Move from cell A1 to R362 by selecting control tool or something Sheila Excel Discussion (Misc queries) 5 March 21st 08 12:08 AM
Selecting Refedit value monika Excel Programming 5 April 6th 04 06:09 AM
Shift-Control Arrow and RefEdit Control? Ariel[_2_] Excel Programming 12 January 6th 04 11:10 PM
RefEdit control bug Dag Johansen[_6_] Excel Programming 1 October 20th 03 12:32 PM


All times are GMT +1. The time now is 08:02 AM.

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"