ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SELECT CASE "Jan-03" confusion (https://www.excelbanter.com/excel-programming/332924-select-case-jan-03-confusion.html)

Craigm[_13_]

SELECT CASE "Jan-03" confusion
 

Column M8 through M1800 is a date column and holds dates such a
"2/18/2003 9:28:00 AM" I would like to count the number of entries m
Month and Year.

I can change the format of the column but that only changes th
display. When I run the SELECT CASE below I get all zeros because th
date format for the CASE statement is still "2/18/2003 9:28:00 AM
even though "Feb-03" is displayed in the column.

-----------------------------
Columns("M:M").Select
Selection.NumberFormat = "[$-409]mmm-yy;@"

For Each rIncDate In Range("M8:M149") 'Need Last Row loop

Select Case rIncDate
Case "Jan-03"
iJan03 = iJan03 + 1
Case "Feb-03"
iFeb03 = iFeb03 + 1
Case Else
iOther = iOther + 1
End Select
Next rIncDate
-----------------------------

THANKS FOR YOUR SUGGESTIONS THEY WILL BE GREATLY APPRECIATED!

CRAIG

--
Craig
-----------------------------------------------------------------------
Craigm's Profile: http://www.excelforum.com/member.php...fo&userid=2438
View this thread: http://www.excelforum.com/showthread.php?threadid=38247


anilsolipuram[_113_]

SELECT CASE "Jan-03" confusion
 

minor change in the code




Columns("M:M").Select
Selection.NumberFormat = "[$-409]mmm-yy;@"

For Each rIncDate In Range("M8:M149") 'Need Last Row loop

Select Case format(rIncDate,"mmm-yy") 'change here
Case "Jan-03"
iJan03 = iJan03 + 1
Case "Feb-03"
iFeb03 = iFeb03 + 1
Case Else
iOther = iOther + 1
End Select
Next rIncDat

--
anilsolipura
-----------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...fo&userid=1627
View this thread: http://www.excelforum.com/showthread.php?threadid=38247


Craigm[_14_]

SELECT CASE "Jan-03" confusion
 

It is amazing how many grey cells I can kill.

Thank You. The fix you suggested works exactly as I needed

--
Craig
-----------------------------------------------------------------------
Craigm's Profile: http://www.excelforum.com/member.php...fo&userid=2438
View this thread: http://www.excelforum.com/showthread.php?threadid=38247



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com