Solved

How do I construct a date in Excel VBA from a shortened month name ?

Posted on 2014-07-25
4
160 Views
Last Modified: 2014-07-25
Hi Experts,

I have an Excel sheet in which dates are split out across 3 columns. For example, I have 01 in column A, "Sep" in column B and 2013 in column C.

I want to create a formatted date (dd/mm/yyyy) in column D. How do I do this in VBA (I can do it manually entering a formula) ?

Thanks
Toco
0
Comment
Question by:Tocogroup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40219163
which formula are you using?
0
 
LVL 13

Accepted Solution

by:
duncanb7 earned 500 total points
ID: 40219167
You can try this
Duncan
Sub test()
Sheets(1).Select
With ActiveSheet
.Range("D1").NumberFormat = "dd/mm/yyyy"
.Range("D1").Value = .Range("A1") &. Range("B1") & .Range("C1")
End With
End Sub

Open in new window

0
 

Author Closing Comment

by:Tocogroup
ID: 40219199
Many thanks. That works fine.

To answer the previous expert's question I used =DATEVALUE(1&"/"&MONTH(C2&1)&"/"&B2) as a formula within the sheet. No doubt this can be adapted to a VBA solution.
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40219205
Thanks for your points

Have a nice day

Duncan
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question