AllExperts > Visual Basic 
Search      
Visual Basic
Volunteer
Answers to thousands of questions
 Home · More Visual Basic Questions · Answer Library  · Encyclopedia ·
More Visual Basic Answers
Question Library

Ask a question about Visual Basic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Ravindra
Expertise
visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel.(VB6) basic questions in vb 2008. Optional: 1)a large number of people want me to do work which takes some time and effort. can do projects in vb 2008. Pl.note that i would like to be paid for such work. 2) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time. 3) if you are pleased with my reply you could consider a donation of 1$. 4) you can visit my website http://ravindra.coolpage.biz

Experience

Education/Credentials
engineering, management degrees.

Past/Present Clients
project work for a Norway company,USA company and a Canadian company completed. Freelance Project work and Teaching. helping programmers with their work
teaching vb

 
   

You are here:  Experts > Computing/Technology > Basic > Visual Basic > converting string to date (vba in excel)

Visual Basic - converting string to date (vba in excel)


Expert: Ravindra - 9/4/2009

Question
Hi.  My name is Kevin Tse.  I have taken a course on C++ in NYU Poly a year back.  I have been experimenting with VBA on Excel, and I have created macros which have impressed my supervisor at work.

I can't get this one simple thing on VBA for excel though.  There's a worksheet with a cell that goes, 7/12/09 TO 8/21/11 (or the like).  I need to get it into two boxes on another sheet, one cell saying JUL-09 and another saying AUG-11.

I am a learn-as-I-go type of guy.  I looked up Datevalue and Dateserial and they don't seem to be much help.  I'm kind of stumped here.  Thanks.

Answer
i presently do not remember the function which i used some years before but here is a way

in a module create a public function
Public Function GetMonthName(olage As Integer)
Select Case olage
Case 1
GetMonthName = "Jan"
Case 2

Case 7
GetMonthName = "Jul"
Case 8

' for all 12 months
End Select
End Function
and in the cell you want the result
enter this
=DAY(F3) & Getmonthname(MONTH(F3))  

Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.