Default month
Using XL 2000, i'm populating a combobox using:
With Month .AddItem "January" '0 .AddItem "February" '1 .AddItem "March" '2 .AddItem "April" '3 .AddItem "May" '4 .AddItem "June" '5 .AddItem "July" '6 .AddItem "August" '7 .AddItem "September" '8 .AddItem "October" '9 .AddItem "November" '10 .AddItem "December" '11 End With I would like the current month to default in the combobx. any ideas appreciated. Thanks, Paul |
Default month
Hi Paul,
Something like this should work for you: .Value = Format$(Date, "Mmmm") One comment - I would pick a different name for your ComboBox, as Month is a reserved keyword. I don't think it will cause any problems, but better safe than sorry. I typically use "cbo" in front of a ComboBox name so I know at first glance what type of object it is. So you could use "cboMonth" or similar. -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Paul wrote: Using XL 2000, i'm populating a combobox using: With Month .AddItem "January" '0 .AddItem "February" '1 .AddItem "March" '2 .AddItem "April" '3 .AddItem "May" '4 .AddItem "June" '5 .AddItem "July" '6 .AddItem "August" '7 .AddItem "September" '8 .AddItem "October" '9 .AddItem "November" '10 .AddItem "December" '11 End With I would like the current month to default in the combobx. any ideas appreciated. Thanks, Paul |
Default month
Good thinking Jake,
solution works fine. Thanks, Paul -----Original Message----- Hi Paul, Something like this should work for you: .Value = Format$(Date, "Mmmm") One comment - I would pick a different name for your ComboBox, as Month is a reserved keyword. I don't think it will cause any problems, but better safe than sorry. I typically use "cbo" in front of a ComboBox name so I know at first glance what type of object it is. So you could use "cboMonth" or similar. -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Paul wrote: Using XL 2000, i'm populating a combobox using: With Month .AddItem "January" '0 .AddItem "February" '1 .AddItem "March" '2 .AddItem "April" '3 .AddItem "May" '4 .AddItem "June" '5 .AddItem "July" '6 .AddItem "August" '7 .AddItem "September" '8 .AddItem "October" '9 .AddItem "November" '10 .AddItem "December" '11 End With I would like the current month to default in the combobx. any ideas appreciated. Thanks, Paul . |
Default month
With Month
.AddItem "January" '0 .AddItem "February" '1 .AddItem "March" '2 .AddItem "April" '3 .AddItem "May" '4 .AddItem "June" '5 .AddItem "July" '6 .AddItem "August" '7 .AddItem "September" '8 .AddItem "October" '9 .AddItem "November" '10 .AddItem "December" '11 .ListIndex = Month(Date)-1 End With -- Regards, Tom Ogilvy "Paul" wrote in message ... Using XL 2000, i'm populating a combobox using: With Month .AddItem "January" '0 .AddItem "February" '1 .AddItem "March" '2 .AddItem "April" '3 .AddItem "May" '4 .AddItem "June" '5 .AddItem "July" '6 .AddItem "August" '7 .AddItem "September" '8 .AddItem "October" '9 .AddItem "November" '10 .AddItem "December" '11 End With I would like the current month to default in the combobx. any ideas appreciated. Thanks, Paul |
Default month
For information:
? Format$(Date, "Mmmm") October ? format$(date,"mMmM") October -- Regards, Tom Ogilvy "Jake Marx" wrote in message ... Hi Paul, Something like this should work for you: .Value = Format$(Date, "Mmmm") One comment - I would pick a different name for your ComboBox, as Month is a reserved keyword. I don't think it will cause any problems, but better safe than sorry. I typically use "cbo" in front of a ComboBox name so I know at first glance what type of object it is. So you could use "cboMonth" or similar. -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Paul wrote: Using XL 2000, i'm populating a combobox using: With Month .AddItem "January" '0 .AddItem "February" '1 .AddItem "March" '2 .AddItem "April" '3 .AddItem "May" '4 .AddItem "June" '5 .AddItem "July" '6 .AddItem "August" '7 .AddItem "September" '8 .AddItem "October" '9 .AddItem "November" '10 .AddItem "December" '11 End With I would like the current month to default in the combobx. any ideas appreciated. Thanks, Paul |
Default month
Thanks, Tom. Actually, I like your ListIndex method better.
-- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Tom Ogilvy wrote: For information: ? Format$(Date, "Mmmm") October ? format$(date,"mMmM") October "Jake Marx" wrote in message ... Hi Paul, Something like this should work for you: .Value = Format$(Date, "Mmmm") One comment - I would pick a different name for your ComboBox, as Month is a reserved keyword. I don't think it will cause any problems, but better safe than sorry. I typically use "cbo" in front of a ComboBox name so I know at first glance what type of object it is. So you could use "cboMonth" or similar. -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Paul wrote: Using XL 2000, i'm populating a combobox using: With Month .AddItem "January" '0 .AddItem "February" '1 .AddItem "March" '2 .AddItem "April" '3 .AddItem "May" '4 .AddItem "June" '5 .AddItem "July" '6 .AddItem "August" '7 .AddItem "September" '8 .AddItem "October" '9 .AddItem "November" '10 .AddItem "December" '11 End With I would like the current month to default in the combobx. any ideas appreciated. Thanks, Paul |
All times are GMT +1. The time now is 11:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com