![]() |
Enter WEDNESDAY, not Wednesday
Excel Experts,
My code enters in A2 the date and day of the week for the last trade date (business date) in the format: 10/19/05 Wednesday However, I'd like the day of the week to be all Caps, so that the code enters: 10/19/05 WEDNESDAY How would I change the code below to enter the day of the week in all caps. Thanks in advance, Alan Sub NewDate() Dim sDate As String Dim sDay As String 'Updates date field with last trading day sDate = Evaluate("=TODAY()-IF(WEEKDAY(TODAY())=2,3,1)") sDate = Format(sDate, "mm/dd/yy") sDay = Evaluate("=TODAY()-IF(WEEKDAY(TODAY())=2,3,1)") sDay = Format(sDate, "dddd") Range("A2").Select Selection.Formula = sDate & " " & sDay End Sub -- achidsey |
Enter WEDNESDAY, not Wednesday
Hi,
Try with Ucase ... ... = sDate & " " & UCase(sDay) -- Regards, Sébastien <http://www.ondemandanalysis.com "achidsey" wrote: Excel Experts, My code enters in A2 the date and day of the week for the last trade date (business date) in the format: 10/19/05 Wednesday However, I'd like the day of the week to be all Caps, so that the code enters: 10/19/05 WEDNESDAY How would I change the code below to enter the day of the week in all caps. Thanks in advance, Alan Sub NewDate() Dim sDate As String Dim sDay As String 'Updates date field with last trading day sDate = Evaluate("=TODAY()-IF(WEEKDAY(TODAY())=2,3,1)") sDate = Format(sDate, "mm/dd/yy") sDay = Evaluate("=TODAY()-IF(WEEKDAY(TODAY())=2,3,1)") sDay = Format(sDate, "dddd") Range("A2").Select Selection.Formula = sDate & " " & sDay End Sub -- achidsey |
Enter WEDNESDAY, not Wednesday
Perfect. Thanks Sebastienm. Alan -- achidsey "sebastienm" wrote: Hi, Try with Ucase ... ... = sDate & " " & UCase(sDay) -- Regards, Sébastien <http://www.ondemandanalysis.com "achidsey" wrote: Excel Experts, My code enters in A2 the date and day of the week for the last trade date (business date) in the format: 10/19/05 Wednesday However, I'd like the day of the week to be all Caps, so that the code enters: 10/19/05 WEDNESDAY How would I change the code below to enter the day of the week in all caps. Thanks in advance, Alan Sub NewDate() Dim sDate As String Dim sDay As String 'Updates date field with last trading day sDate = Evaluate("=TODAY()-IF(WEEKDAY(TODAY())=2,3,1)") sDate = Format(sDate, "mm/dd/yy") sDay = Evaluate("=TODAY()-IF(WEEKDAY(TODAY())=2,3,1)") sDay = Format(sDate, "dddd") Range("A2").Select Selection.Formula = sDate & " " & sDay End Sub -- achidsey |
Enter WEDNESDAY, not Wednesday
or just change your last line:
Selection.Formula = sDate & " " & UCase(sDay) -- Gary "achidsey" (notmorespam) wrote in message ... Perfect. Thanks Sebastienm. Alan -- achidsey "sebastienm" wrote: Hi, Try with Ucase ... ... = sDate & " " & UCase(sDay) -- Regards, Sébastien <http://www.ondemandanalysis.com "achidsey" wrote: Excel Experts, My code enters in A2 the date and day of the week for the last trade date (business date) in the format: 10/19/05 Wednesday However, I'd like the day of the week to be all Caps, so that the code enters: 10/19/05 WEDNESDAY How would I change the code below to enter the day of the week in all caps. Thanks in advance, Alan Sub NewDate() Dim sDate As String Dim sDay As String 'Updates date field with last trading day sDate = Evaluate("=TODAY()-IF(WEEKDAY(TODAY())=2,3,1)") sDate = Format(sDate, "mm/dd/yy") sDay = Evaluate("=TODAY()-IF(WEEKDAY(TODAY())=2,3,1)") sDay = Format(sDate, "dddd") Range("A2").Select Selection.Formula = sDate & " " & sDay End Sub -- achidsey |
All times are GMT +1. The time now is 10:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com