Hi Brad,
The Format() function is the VBA equivalent of the TEXT() worksheet function. Here's a routine that converts a passed range of dates into formatted text:
Sub TestFormatDataAsText()
FormatDataAsText Range("E:E")
End Sub
Sub FormatDataAsText(ByRef DateRange As Range)
Dim cel As Range
If DateRange Is Nothing Then Exit Sub
For Each cel In Intersect(DateRange, DateRange.Parent.UsedRange
cel.NumberFormat = "@"
cel = Format(cel.Value, "m-d-yyyy")
Next cel
End Sub
Jim
Main Topics
Browse All Topics





by: saurabh726Posted on 2007-12-19 at 05:51:21ID: 20499465
Hi Brad..
I have a question here...the input ur using are two coloumns..However ur giving output in 1 only...how do u determine which input is taken in which case...i.e in which case it will be a1 or b1 for the output in e1...or the output will be in both e1 and f1..
Saurabh..