MrExcel Publishing
Your One Stop for Excel Tips & Solutions

loop problem


Posted by Michael on December 27, 2001 1:52 PM

I have a drop down list of of the months of the year, in order. I used the Data Validation way to creat the drop down. Now, in a macro, I need to convert the month that was selected (Worksheet("Data Sheet").Cells(2,4).Value) to the numerical equivalent (ie January ->01, September->09). How can I do this quickly?


Posted by John on December 27, 2001 2:13 PM

In your validation list why not use a date instead of the name of the month. Then format as "mmmm", then in your code you can just use the Month() function to return the month number.

Posted by Tom on December 27, 2001 3:42 PM

If the months are in order, then the index value of your selection, plus 1, will be the numeric value of the month