View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Getting error using Month()

Try this

MsgBox Month(Sheets("mainworksheet").Range("B19").Value)

Mike

" wrote:

Hi,

I am confused and need some assistance.
In my Vba code I am trying to verify if todays month is different than
the one in cell.
Problem is I am getting an error using the Month().

MsgBox (Month(MainWorksSheet.Range("B19").Value))

The code above gives me the error that the Object doesnt support the
property.
The range value is a date 2008/07/02.

Using the Year() function it works and returns 2008 as it should.
What am I missing with the month function?

Thanks