Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Suppose I want to write the following which are strings If reportingMonth statusMonth Then .... Since they are strings, the comparaison is not good. However if I add Enum lesMois janvier = 1 février = 2 mars = 3 avril = 4 mai = 5 juin = 6 juillet = 7 août = 8 septembre = 9 octobre = 10 novembre = 11 décembre = 12 End Enum can I do that comparaison and how do I use it so that it refers to the numerical equivalent? Thank you for your suggestions. Daniel |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
An enum won't work for this, as there is no way to use the enum's string
literals. It's better to use a collection, e.g. Dim cMonths As New Collection cMonths.Add 1, "janvier" cMonths.Add 2, "février" cMonths.Add 3, "mars" cMonths.Add 4, "avril" cMonths.Add 5, "mai" cMonths.Add 6, "juin" cMonths.Add 7, "juillet" cMonths.Add 8, "août" cMonths.Add 9, "septembre" cMonths.Add 10, "octobre" cMonths.Add 11, "novembre" cMonths.Add 12, "décembre" If cMonths(LCase(reportingMonth)) cMonths(LCase(statusMonth)) Then ... End If Hope this helps. "Daniel" wrote in message ... Hello, Suppose I want to write the following which are strings If reportingMonth statusMonth Then .... Since they are strings, the comparaison is not good. However if I add Enum lesMois janvier = 1 février = 2 mars = 3 avril = 4 mai = 5 juin = 6 juillet = 7 août = 8 septembre = 9 octobre = 10 novembre = 11 décembre = 12 End Enum can I do that comparaison and how do I use it so that it refers to the numerical equivalent? Thank you for your suggestions. Daniel |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you Paul, this is doing the job, perfectly.
_______________ "Paul Reynolds" a écrit dans le message de ... An enum won't work for this, as there is no way to use the enum's string literals. It's better to use a collection, e.g. Dim cMonths As New Collection cMonths.Add 1, "janvier" cMonths.Add 2, "février" cMonths.Add 3, "mars" cMonths.Add 4, "avril" cMonths.Add 5, "mai" cMonths.Add 6, "juin" cMonths.Add 7, "juillet" cMonths.Add 8, "août" cMonths.Add 9, "septembre" cMonths.Add 10, "octobre" cMonths.Add 11, "novembre" cMonths.Add 12, "décembre" If cMonths(LCase(reportingMonth)) cMonths(LCase(statusMonth)) Then ... End If Hope this helps. "Daniel" wrote in message ... Hello, Suppose I want to write the following which are strings If reportingMonth statusMonth Then .... Since they are strings, the comparaison is not good. However if I add Enum lesMois janvier = 1 février = 2 mars = 3 avril = 4 mai = 5 juin = 6 juillet = 7 août = 8 septembre = 9 octobre = 10 novembre = 11 décembre = 12 End Enum can I do that comparaison and how do I use it so that it refers to the numerical equivalent? Thank you for your suggestions. Daniel |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If cdate(ReportingMonth & " 1, 2003") cDate(statusMonth & " 1, 2003") then
-- Regards, Tom Ogilvy Daniel wrote in message ... Hello, Suppose I want to write the following which are strings If reportingMonth statusMonth Then .... Since they are strings, the comparaison is not good. However if I add Enum lesMois janvier = 1 février = 2 mars = 3 avril = 4 mai = 5 juin = 6 juillet = 7 août = 8 septembre = 9 octobre = 10 novembre = 11 décembre = 12 End Enum can I do that comparaison and how do I use it so that it refers to the numerical equivalent? Thank you for your suggestions. Daniel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Enum in Excel 97 | Excel Programming | |||
Enum in Excel 97 | Excel Programming |