Thread: Date Formatting
View Single Post
  #9  
Old January 8th, 2006, 03:56 PM posted to microsoft.public.excel.misc
external usenet poster
 
Posts: n/a
Default Date Formatting

If you copied the code to the sheet module as described, you should have got
the two lines as required. It worked fine in my tests.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Big Rick" wrote in message
...
Dear Bob
I'm afraid that I have never got to grips with any form of VBA before. I
have followed the on screen insructions and pasted the code into the

sheet1
tab, but where do I go from there.
What I have done is simply pasted the code in, closed the screen, and
entered a date in H1 but the wrap is not working. I have still formatted

the
cell as wrap text but this did not help. I know that I am going wrong
somewhere, but I know that you are the one to guide me through.

Best Regards
--
--
Big Rick


"Bob Phillips" wrote:

One way

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If IsDate(.Value) Then
If .NumberFormat = "dddd dd mmmm yyyy" Then
.Value = Format(.Value, "dddd " & vbLf & "dd mmmm

yyyy")
End If
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.




--
HTH

Bob Phillips