View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Getting error using Month()

On Fri, 8 Feb 2008 08:20:23 -0800 (PST), "
wrote:

Mainworksheet is a Worksheet variable that was defined the sheet name
that I need to work on.
I dont think that is the problem.
The problem is with the month() function that gives an error.
I can get the date result from MainWorksSheet.Range("B19").Value, but
month() complains about it.
Cell B19 is defined as date and it contains todays date on the format
of "2008/02/08"
Why can't month() work with it??


I canNOT reproduce your problem with this:

=================================
Option Explicit
Sub foo()
Dim MainWorksSheet As Worksheet
Set MainWorksSheet = ActiveSheet
MsgBox (Month(MainWorksSheet.Range("B19").Value))
End Sub
====================================

Let us see some more of your code.
--ron