Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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

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
Change Default Auto-Fill-In month scootr Excel Discussion (Misc queries) 5 April 19th 10 05:07 PM
Enter day, default month and year Tim Elhatton Excel Discussion (Misc queries) 2 October 31st 07 09:55 PM
Default to month end Brisbane Rob Excel Discussion (Misc queries) 3 July 13th 06 11:53 AM
How to manage/change the default month/day date format? Chuckie Excel Discussion (Misc queries) 2 July 13th 05 04:29 PM
Default to beginning of month Heather Excel Worksheet Functions 4 April 22nd 05 09:43 PM


All times are GMT +1. The time now is 01:50 PM.

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"