Read Month/If Statement/Assing Quartal

Hello,
I want to read current month from the sistem (date.Now.Month) and then base on that determine the current Quartal. My idea was to use 4 various if Statements like:

if Month =(1 or 2 or 3) then message Box “Q1”, if Month =(4 or 5 or 6) then message Box “Q2”…- I don´t think this it the most efficient way-is there some Function for Quartals?

Even if it is the best approch to tackle this one, it is not workig for me.

Month is variable type of double. If I Change it to string if Statement won´t work as is statets that implicit conversion from string to double is not allowed. If I leave it as a double if Statement is not recognazing them - that means as we are now in November => Month=11. Thant means that in fourt if Statement I would have to get “Q4” message from the message box.

Help;)

Regards,
S.

@sspi1153,

Try like this,

So simple and so smart!
Thanks!

Another way to do it is: quarter = CInt(Math.Ceiling(Now.Month/3))

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.