Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello, I am trying to use the below VBA code to show the words "YTD May" or the month 45 days ago. Something is not correct in my code, because after running it displays "YTD 5" Range("i3").Value = "YTD " & Month(Now() - 45) How can I correct the formatting of the Month in this code? Thank You |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
You can use the format function Range("i3").Value = "YTD " & Format(Month(Date - 45), "mmm") -- Regards Ron de Bruin http://www.rondebruin.nl "tjh" wrote in message ... Hello, I am trying to use the below VBA code to show the words "YTD May" or the month 45 days ago. Something is not correct in my code, because after running it displays "YTD 5" Range("i3").Value = "YTD " & Month(Now() - 45) How can I correct the formatting of the Month in this code? Thank You |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank You that helps the formatting. However, after inputing this
information, the month is always showing January. Why is this and how can I get it to show May with the formula. "Ron de Bruin" wrote: Hi You can use the format function Range("i3").Value = "YTD " & Format(Month(Date - 45), "mmm") -- Regards Ron de Bruin http://www.rondebruin.nl "tjh" wrote in message ... Hello, I am trying to use the below VBA code to show the words "YTD May" or the month 45 days ago. Something is not correct in my code, because after running it displays "YTD 5" Range("i3").Value = "YTD " & Month(Now() - 45) How can I correct the formatting of the Month in this code? Thank You |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This may help you.
http://www.w3schools.com/vbscript/func_monthname.asp "tjh" wrote in message ... Hello, I am trying to use the below VBA code to show the words "YTD May" or the month 45 days ago. Something is not correct in my code, because after running it displays "YTD 5" Range("i3").Value = "YTD " & Month(Now() - 45) How can I correct the formatting of the Month in this code? Thank You |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oops
Range("i3").Value = "YTD " & Format(Date - 45, "mmm") -- Regards Ron de Bruin http://www.rondebruin.nl "tjh" wrote in message ... Thank You that helps the formatting. However, after inputing this information, the month is always showing January. Why is this and how can I get it to show May with the formula. "Ron de Bruin" wrote: Hi You can use the format function Range("i3").Value = "YTD " & Format(Month(Date - 45), "mmm") -- Regards Ron de Bruin http://www.rondebruin.nl "tjh" wrote in message ... Hello, I am trying to use the below VBA code to show the words "YTD May" or the month 45 days ago. Something is not correct in my code, because after running it displays "YTD 5" Range("i3").Value = "YTD " & Month(Now() - 45) How can I correct the formatting of the Month in this code? Thank You |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|