View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Macro: MonthName Function, runtime error 424

cbetmark,

Sub test()
Worksheets("Report").Range("A1").Value = _
Format(Worksheets("WKO").Range("C3").Value, "mmmm")
End Sub

Or you could use a formula in cell A1 of Report:

=WKO!C3

and format cell A1 of Report for custom, mmmm

HTH,
Bernie
MS Excel MVP


"cbetmark" wrote in message
...

I have a workbook with 2 worksheets named WKO and Report. I am trying
to write a macro to look at a cell containing a date in worksheet WKO
and put the month's name in a cell on worksheet Report. The date
format of the cell is 2005/07/05. Here is my code.

Sub
Dim j as String

j = MonthName(Month(WKO!C3))

Range("A1").Select
ActiveCell.Formula = "j"

End Sub

I get a 424 Runtime Error - No Object Defined for the line j
=MonthName(Month(WKO!C3))


--
cbetmark
------------------------------------------------------------------------
cbetmark's Profile: http://www.excelforum.com/member.php...o&userid=26193
View this thread: http://www.excelforum.com/showthread...hreadid=395003