Solved

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

Posted on 2014-07-25
4
156 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
  • 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now