Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Extracting Part of a Date
Hi,
I have a variable in VBA called myDate and I need to extract the fist two letter of the day, from the date which is stored in myDate. For example, if myDate = Tuesday, July 3 2007, then I need to put 'TU' into variable of myDay. Can anyone help? Thanks. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Extracting Part of a Date
Maybe this might help (extracted from VBA Help:
Left Function Example This example uses the Left function to return a specified number of characters from the left side of a string. Dim AnyString, MyStr AnyString = "Hello World" ' Define string. MyStr = Left(AnyString, 1) ' Returns "H". MyStr = Left(AnyString, 7) ' Returns "Hello W". MyStr = Left(AnyString, 20) ' Returns "Hello World". Regards, Jan BArt "GLT" wrote: Hi, I have a variable in VBA called myDate and I need to extract the fist two letter of the day, from the date which is stored in myDate. For example, if myDate = Tuesday, July 3 2007, then I need to put 'TU' into variable of myDay. Can anyone help? Thanks. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Extracting Part of a Date
I did the following from the Immediate Pane:
mydate = now() ? mydate 11/22/2005 3:59:29 PM mydate = ucase(left(weekdayname(weekday(mydate)),2)) ? mydate TU "GLT" wrote: Hi, I have a variable in VBA called myDate and I need to extract the fist two letter of the day, from the date which is stored in myDate. For example, if myDate = Tuesday, July 3 2007, then I need to put 'TU' into variable of myDay. Can anyone help? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I create a schedule from a list of dates ? | Charts and Charting in Excel | |||
NETWORKDAYS - Multiple Date Selection | Excel Discussion (Misc queries) | |||
Can a date be used for conditional formatting? | Excel Worksheet Functions | |||
Formula for Extracting Month out of a Date column | Excel Discussion (Misc queries) | |||
Date Math Problem | Excel Worksheet Functions |