![]() |
cmb displayed item vs list
I wasn't sure how to phrase the subject line but what I am looking to do is
populate two list boxes (Start & End) with dates that become available after refreshing a query. What I do not know how to do is setting the default display of each combo box as specific days. cmbStartdate should start with the last day of the month, 2 months ago cmbEndDate should start with the last day of the month, 1 month ago. All dates from the range should be available in both combo boxes, but to save the user time I would like each box to start on those days mentioned. Is this possible? Thanks!! |
cmb displayed item vs list
Your question is not clear at all. I assume the start and end dates you
refer to mean the dates the combo boxes should indicate when the form is loaded, with actual start & end dates some time before and after these. Anyway, following assumes end date is today, start date 10 weeks ago, and the initial indicated dates are the last dates of each of the two preceding months. I doubt that's what you really want but hopefully you can adapt to your needs. 'in a userform with two ComboBox's named ' cmbStartdate & cmbEndDate Private Sub UserForm_Initialize() Dim d As Date Dim dt0 As Date, dt1 As Date, dt2 As Date, dt3 As Date dt3 = Date dt0 = dt3 - 7 * 10 dt2 = dt3 - Day(dt3) dt1 = dt2 - Day(dt2) ReDim aDates(dt0 To dt3) As String For d = dt0 To dt3 aDates(d) = Format(d, "dd-mmm-yy") Next cmbStartdate.List = aDates cmbStartdate.ListIndex = dt1 - dt0 cmbEndDate.List = aDates cmbEndDate.ListIndex = dt2 - dt0 End Sub Regards, Peter T "Bythsx-Addagio" wrote in message ... I wasn't sure how to phrase the subject line but what I am looking to do is populate two list boxes (Start & End) with dates that become available after refreshing a query. What I do not know how to do is setting the default display of each combo box as specific days. cmbStartdate should start with the last day of the month, 2 months ago cmbEndDate should start with the last day of the month, 1 month ago. All dates from the range should be available in both combo boxes, but to save the user time I would like each box to start on those days mentioned. Is this possible? Thanks!! |
All times are GMT +1. The time now is 10:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com