Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your code works fine for me with column C formatted as a date. Might try
changing to this code to see if it helps identify the problem for you. Your code is in the worksheet's code module, isn't it? You can check by right-clicking the sheet's name tab and choosing [View Code] from the list. Your code should be visible when the VB Editor opens. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 And Target.Cells.Count = 1 Then Dim strDate As String If IsDate(Target) Then strDate = Format(Target.Value, "mmmm") Range("A20").Value = strDate Else MsgBox "Not a date: " & Target.Value End If Else Exit Sub End If End Sub "Chip Dukes" wrote: 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) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Date arithmetic: adding 1 month to prior end of month date | Excel Worksheet Functions | |||
Sort month/date/year data using month and date only | Excel Discussion (Misc queries) | |||
How can i change cell colour depending on month of date in cell? | Excel Discussion (Misc queries) | |||
Calculate month-end date from date in adjacent cell? | Excel Worksheet Functions | |||
Increasing cell date by a month | Excel Programming |