ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date formatting (https://www.excelbanter.com/excel-programming/409656-date-formatting.html)

Sandy

Date formatting
 
Excel 2003
I have dates in Cells B4 (10 March 2007) and F4 (20 October 2007).
Formatting is "dd mmmm yyyy".

I have, as part of a macro:-
Range("A1").Value = "You have selected rounds between '" & Range("B4") & _
"' and '" & Range("F4") & "'"

which produces:-
You have selected rounds between '10/03/2007' and '20/10/2007'

I would like it to read:-
You have selected rounds between '10 March 2007' and '20 October 2007'.

How can I adjust my code to produce this result?
Sandy



Mike H

Date formatting
 
Sandy,

Try this

Range("A1").Value = "You have selected rounds between '" _
& Format(Range("B4"), "DD MMMM YY") & "' and '" & Format(Range("F4"), _
"DD MMMM YYYY") & "'"

Mike

"Sandy" wrote:

Excel 2003
I have dates in Cells B4 (10 March 2007) and F4 (20 October 2007).
Formatting is "dd mmmm yyyy".

I have, as part of a macro:-
Range("A1").Value = "You have selected rounds between '" & Range("B4") & _
"' and '" & Range("F4") & "'"

which produces:-
You have selected rounds between '10/03/2007' and '20/10/2007'

I would like it to read:-
You have selected rounds between '10 March 2007' and '20 October 2007'.

How can I adjust my code to produce this result?
Sandy



Sandy

Date formatting
 
Ah the parentheses make all the difference - I nearly had it.
Thank you very much Mike
Sandy

"Mike H" wrote in message
...
Sandy,

Try this

Range("A1").Value = "You have selected rounds between '" _
& Format(Range("B4"), "DD MMMM YY") & "' and '" & Format(Range("F4"), _
"DD MMMM YYYY") & "'"

Mike

"Sandy" wrote:

Excel 2003
I have dates in Cells B4 (10 March 2007) and F4 (20 October 2007).
Formatting is "dd mmmm yyyy".

I have, as part of a macro:-
Range("A1").Value = "You have selected rounds between '" & Range("B4") &
_
"' and '" & Range("F4") & "'"

which produces:-
You have selected rounds between '10/03/2007' and '20/10/2007'

I would like it to read:-
You have selected rounds between '10 March 2007' and '20 October 2007'.

How can I adjust my code to produce this result?
Sandy



Mike H

Date formatting
 
Your welcome and thanks for the feedback

"Sandy" wrote:

Ah the parentheses make all the difference - I nearly had it.
Thank you very much Mike
Sandy

"Mike H" wrote in message
...
Sandy,

Try this

Range("A1").Value = "You have selected rounds between '" _
& Format(Range("B4"), "DD MMMM YY") & "' and '" & Format(Range("F4"), _
"DD MMMM YYYY") & "'"

Mike

"Sandy" wrote:

Excel 2003
I have dates in Cells B4 (10 March 2007) and F4 (20 October 2007).
Formatting is "dd mmmm yyyy".

I have, as part of a macro:-
Range("A1").Value = "You have selected rounds between '" & Range("B4") &
_
"' and '" & Range("F4") & "'"

which produces:-
You have selected rounds between '10/03/2007' and '20/10/2007'

I would like it to read:-
You have selected rounds between '10 March 2007' and '20 October 2007'.

How can I adjust my code to produce this result?
Sandy




All times are GMT +1. The time now is 10:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com