Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Get Month name from Date value in cell

and just to add for those who might be interested.
it also has a weekday function.

Range("A20").value = WeekdayName(Weekday(Target.Value)

FSt1

"Rick Rothstein" wrote:

Others have addressed your main question, I just thought I would mention to
you (and the others out there who weren't aware of it) that VB has a
MonthName function... it takes the month number as its first argument and an
optional Boolean second argument letting you control whether the full or
abbreviated month name it returned. So, the code in the True portion of your
If/Then/Else block could have be this...

Range("A20").Value = MonthName(Month(Target.Value))

--
Rick (MVP - Excel)



"Chip Dukes" wrote in message
...
I'm trying to get the month from a date representation as follows ...

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 3 And Target.Cells.Count = 1 Then
Dim strDate As String
strDate = Format(Target.Value, "mmmm")
Range("A20").Value = strDate
Else
Exit Sub
End If

End Sub

The error I am getting is ... "Object Required"

on the ... strDate = Format(Target.Value, "mmmm") ...

line

by which I'm guessing Target.Value is not being seen as a date type ...

Any ideas as to how I could get the month from a value entered into a call
... the value will always be in the form 5/24/55 ... from which I need the
string "May"

Chip Dukes
(New to Excel programming)

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date arithmetic: adding 1 month to prior end of month date manxman Excel Worksheet Functions 2 July 14th 06 09:29 PM
Sort month/date/year data using month and date only SMW820 Excel Discussion (Misc queries) 6 June 22nd 06 05:14 PM
How can i change cell colour depending on month of date in cell? andy75 Excel Discussion (Misc queries) 2 January 6th 06 07:46 AM
Calculate month-end date from date in adjacent cell? Matt D Francis Excel Worksheet Functions 4 May 19th 05 04:55 AM
Increasing cell date by a month Robert Christie[_3_] Excel Programming 5 October 12th 04 01:25 PM


All times are GMT +1. The time now is 04:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"