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.
0
GLT (16)
11/22/2005 2:59:04 PM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
521 Views

Similar Articles

[PageSpeed] 17

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.
0
11/22/2005 3:55:16 PM
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.
0
Kleev (20)
11/23/2005 12:04:01 AM
Reply:

Similar Artilces:

cutoff date
To tie adjusted book balance to the GL at a point in time require that a cutoff date be used for reconciliations? Is there any way to reprint the reconciliation report for a particular check book or only by audit code? Thanks! ...

getting error out of date range
i am getting an error out of date range when make an appt on a calander ( sending to someone else the are gettign the error ) ...

Showing date last saved
I want one of the cells on my worksheet to show the date the file was last saved on - and to update automatically. What's the best way to do this? Thanks Colin -- You need code to do this, One way to do it, copy this code into the this 'ThisWorkbook' window in the VBA editor. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Sheet1.Range("A1").Value = Date Sheet1.Range("A2").Value = Time End Sub This will put the date saved into A1 and the time saved into A2. To have the date and time in one cell use Sheet1.Range("A...

Sumifs with data and dates
I need a formula for each item in col A that was added during 2010 only. the spreadsheet will have years of data. A B Expense Date Amount Furniture 1/12/2010 $326.00 Inventory 1/15/2010 $250.00 Utilities 1/15/2010 $98.00 Rent 1/29/2010 $1,000.00 Rent 1/30/2010 $536.00 how can I Sumif with Critera in Col A and only for a specific year? Gary Submitted via EggHeadCafe - Software Developer Portal of Choice Silverlight, WPF, XAML and InnerWorkings Coding Challenge http://www.eggheadcafe.com/tutorials/aspnet/f...

Showing how much longer for a due date.
I am trying to figure out how to show how much longer someone will have to send a product back if they only have 30 days to return it. I would like the cell to count down from 30-1 and show colors at different stages. Is this possible or am I asking too much? Dear, You need to be more specific on this. Is there any date element associated with this or you are going to enter the date on which someone returns the product back on the scale of 1 to 30 days. Thanks -- Dilip Kumar Pandey MBA, BCA, B.Com(Hons.) dilipandey@yahoo.com dilipandey@gmail.com New Delhi, India "daddyr" ...

date in cell comment
Hi all, I want to put todays date with a certain format (d-m-yy) in the comment of cell B3. Can't find the proper code. Please help. TIA Jack Sons The Netherlands One way: Public Sub InsertDateInB3() With Range("B3") On Error Resume Next .Comment.Delete On Error GoTo 0 .AddComment Text:=Format(Date, "d-m-yy") End With End Sub In article <eFOqwq6jFHA.576@tk2msftngp13.phx.gbl>, "Jack Sons" <j.sons@planet.nl> wrote: > Hi all, > > I want to put todays date wi...

Advanced Search Criteria
Just an FYI, since there doesn't seem to be a solution posted anywhere on the web, at least that I could find. If you want to search using dynamic dates, at least in the case of finding items older than a certain relative date, such as more than 30 days old, I used the following criteria successfully in Outlook 2007: Advanced Find > Advanced (tab) > Field: Sent Condition: On or after Value: 30 days ago ...

writing meeting notes with DAte stamps
I am new to Outlook coming from ACT and trying to understand best way to take notes, attach to contacts and make sure the date is automatically input in notes. I would loveto use one program to manage my contacts, but Act has been very easy to use. -- Pete H what version of outlook? -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-...

Change date
I have a rather large list of dates that are in a column and are written first as year then month then day Ex: 20051116. I want to change all of them in a date format like this 11/16/2005 with out retyping each one. I have tried to change the format but excel will not read it. I have tried to make a macro but excel only changed that one cell not the entire column. Please help. On Fri, 22 Apr 2005 17:29:30 -0700, "Quandary" <Quandary@discussions.microsoft.com> wrote: >I have a rather large list of dates that are in a column and are written >first as year then mont...

calculating dates prior to a given date
Hi. I am trying create a spreadsheet that will have dates listed in one column and have another column list the date 14 days prior to the first column's dates. I'm hoping to then organize the second column ascending from the closest to the furthest date, compared to the current date. If anyone has any help they could provide it would be much appreciated. Thank You. If you have a date in A1 and you want another date in B1 which is 14 days earlier, then put this in B1: =3DA1-14 Copy this formula down, then fix the values by selecting all those cells with the formula ...

Calculating date difference
Hi I need to calculate the number of years of service for person(difference between Start_Date & End_Date). The result should b in terms of years, months and days (all in one single cell). Ca someone please help? Thanks ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com Have a look at Chip's site: http://www.cpearson.com/excel/datedif.htm Andy. "rll" <rll.xjm6a@excelforum-nospam.com> wrote in message news:rll.xjm6a@excelforum-nospam.com... > &...

how do you keep a column in date form
i'm making a spreedsheet in office excel, in column A I have a list of dates. I would type in 4/5 for an date and excel would automatic change the date to 4-Apr. I like this way, but when I got to cell 26, the change will not happen. I type in 4/5 and I get just the number 1 in the cell, for the rest of the cells down, can someone help me. Copy the cell that has the format you like and paste format it to the cells that you want to have the date format. "s2m2" <s2m2@discussions.microsoft.com> wrote in message news:F350F90F-24B9-4B79-BE39-20AB0414015D@microsoft.com......

Date Modified changed Money 2005
I am not sure what is going on. After I closed the Microsoft money file for the night about 2 hours later I noticed that the time change of when the files was last updated. Example. I ran the Program and money file at 8 pm. I was done by 8:30 pm. but I noticed it chaged the date of last modified to 10 pm. Sould I be worried that someone might be hacking in to my system? how can I tell who last accessed the file and where from? is Microsoft sending updates to my passport acount with out me knowing it? please help me out. Should I be worried? Thank you Mike H Have you a Pocket PC...

Adding text and date problem
I have text in column 1, a date in column 2 and in column 3 I wish to show the text followed by the date. I have tried both Concatenate and & but the the result is text followed by the underlying number representing the date. I cannot seem to format this column to show the date as dd/mm/yy. Any suggestions? Regards ="Today is: "&TEXT(A1,"mm/dd/yyyy") -- Kind regards, Niek Otten Microsoft MVP - Excel "newman" <aa111@despammed.com> wrote in message news:464C1646.AC6A42E0@despammed.com... |I have text in column 1, a date in column 2 and in column...

date in register from epay
When sending an epay on a specified date it does not post in my register on that specified date. It shows a date 6 days prior to the requested date. How can this date be shown on the specified date? I expect epay does this for a reason. Nonetheless, you can always overtype the date with whatever you wish. "John Vanek" <vanekjohn@hotmail.com> wrote in message news:38d701c3e362$9ebd92b0$a301280a@phx.gbl... > When sending an epay on a specified date it does not post > in my register on that specified date. It shows a date 6 > days prior to the requested date. How can...

Autoformat dates and times
Hi, I have a workbook with two columns. In the formula bar of one of the cells i have 2005040101700 (YearMonthDateHoursMinutes), but what shows in the cell is 2.00504E+11 When I try to format the cell as yyyymmddhhmm I get ########### and when I put the cursor over the cell with ############### it says that negative dates and times are shown this way. How can I make this work? Thanks. Allison Allison, I'm hoping that your actual value is different: 2005040101700 doesn't make sense: year 2005 month 04 day 01 hour 01 minutes 70 seconds 0 Perhaps it's really 200504010...

post date benefit changes
Hello: In either GP 9.0 or 10.0, is it possible to post-date changes to employee benefit codes in payroll for changes in amounts? There is the Start Date field in Employee Benefit Maintenance. But, this cannot be used for post-dating changes as the next payroll run that you conduct (if before the start date) will not use the benefit code. Is there a third-party that will do this? childofthe1980s GP Payroll does not support post-dated deductions/benefits. The Advanced HR module provides the ability to do effective dating on HR benefits and, by extension, Payroll deductions and benefi...

Account list view up to current date?
I'm using MS Money Plus Deluxe. I often enter in income/expenses far in advance so I can see how things will play out. Account list is my main view and gets distorted since it is taking into account future events. The portfolio view has a nice feature in that it can show only up to the current date and not any future events, such as future retirement contributions I've entered. Is there a way to make the account list do that? Or, is there some way I can see both scenarios without having to maintain two Money files? Bills | Forecast Cash Flow? Beyond that, no. You could not enter...

Table calculations. Season from Date in Hunting Harvest Database.
I am trying to set up a hunting harvest database. I would like to add a column to the original data table that automatically calculates the hunting season, which is based on a specific harvest timeframe. Each harvest record entry has a specific date. For example, when a record of a deer harvested on 12-3-2007 is entered; I want the database to calculate that the date occurred during the fall 2007 season. Thus, I want 2007 to be automatically entered for this record in a separate column. However, our seasons last into the new year, so if for example a record is entered of a ...

Extracting name out of line
I am copying a line off the web with 4 names in it, separated by spaces (From 1 to 6 spaces). I am trying to extract name 3 from the line. Tried split(Var, " ") however Name moves according to the space between the names. Var(2) can be the Name or according to spaces between names, Var(6) Can you help me? Thank you, Gordon On 27 Jan 2007 15:37:39 -0800, "Gordon" <gwelch1938@yahoo.com> wrote: >I am copying a line off the web with 4 names in it, separated by >spaces (From 1 to 6 spaces). I am trying to extract name 3 from the >line. Tried split(V...

Extract Weather News from a Sites
Hi to all, i have to extract the weather report from a site http://wwwa.accuweather.com in VC++ project. but in site they did not provide any rss for Extracting the Weather news .after searching a lot of from the site at last i reached a solution that if i get extract the whole page and then extract the weather report doing some string opration ....but the url format is not similar to all of the the cases. supoose that if i want to see the weather of mumbai ,i m filling the key word in the edit bodx (mumbai,india)then the URL format like this http://wwwa.accuweather.com/world-index-f...

Cell extraction from Multiple worksheets
Hi group, I am new to this newsgroup and am hoping that you can help me out. I took a software/hardware inventory of all the computers in my work's network and imported them all into excel, in their own worksheet. So I have one file, with 128 different worksheets, all containing similar information. What I would like to do is create a new sheet, a summary page, where I can pull the value of the same cell from each sheet and list them. I need to have a list of each computer, with computer name, cpu speed, video card, serial number, ect. If the values that I am searching for are in the same...

Edit Comment erases part of screen; comment uneditable
I have a problem with a worksheet I've used for many years. Although I recently switched to Excel 2007, this had started to occur a while ago, with Excel 2000. If I hover on a cell containing a comment, the comment correctly appears next to the cell. But if I right-click and pick Edit Comment, the following happens: (See screenshot at http://www.blaqzone.com/Temp/ExcelCommentBug.gif) - A rectangular group of cells becomes entirely blank, except for red and green triangles. - The top-right cell in the blanked area flashes slowly. - The comment is nowhere to be seen, and cannot be ac...

report date range
I have a report that will display data from an inventory transaction history form. There I would enter in the date and several other criteria. After doing so I filter the form to my selection and then print my report. I wanted the date range that is on the form to print on the report. I hvae done this in several other reports and never had a problem until now. I'm getting #NAME. The form is still open upon viewing the report. On the report I have a text box with the logic of: ="Report Date Between: " & [Forms]![frmInvTransactionHistory]![BegtDate] & " and &...

Calculate Due Date?
I need a formula that will calculate a due date 10 days from the start date (a1)but if the date falls on a weekend or holiday I need the date to be the next working day. I will have a list of holidays in J2:J50. Thanks for any help.......... -- HTH Bob Phillips "Randy" <ranmcc@msn.com> wrote in message news:1121099149.930051.258040@o13g2000cwo.googlegroups.com... > I need a formula that will calculate a due date 10 days from the start > date (a1)but if the date falls on a weekend or holiday I need the date > to be the next working day. > > I will have a...