Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bill Howell   on Feb 19 In MS Office Category.

  
Question Answered By: Hariz Burki   on Feb 19

How about this:
In the VB Editor, I created a function in my Personal.xls file that looks like:
Function DateFormat(YR, MO, DY)
Dim StrDate
'=PERSONAL.XLS!DateFormat(A1,B1,C1)
Select Case MO
Case "JAN", "JANUARY"
MO = "01"
Case "FEB", "FEBRUARY"
MO = "02"
Case "MAR", "MARCH"
MO = "03"
Case "APR", "APRIL"
MO = "04"
Case "MAY", "MAY"
MO = "05"
Case "JUN", "JUNE"
MO = "06"
Case "JUL", "JULY"
MO = "07"
Case "AUG", "AUGUST"
MO = "08"
Case "SEP", "SEPTEMBER"
MO = "09"
Case "OCT", "OCTOBER"
MO = "10"
Case "NOV", "NOVEMBER"
MO = "11"
Case "DEC", "DECEMBER"
MO = "12"
End Select
StrDate = MO & "-" & DY & "-" & YR
If (IsDate(StrDate)) Then
DateFormat = Format(StrDate, "yyyy-mm-dd")
Else
DateFormat = ""
End If
End Function
Then, in D1 I put:
=PERSONAL.XLS!DateFormat(A1,B1,C1)

Your Personal.xls file will open automatically whenever you open Excel, so the
function
is always available.

(I put  the worksheet  function in as a comment so that I can cut/paste it when I
need it
rather than using the wizard)
Would you like a different approach? I could come up with something.
hope this helps

Share: 

 
 
Didn't find what you were looking for? Find more on referencing another worksheet in different workbook? Or get search suggestion and latest updates.


Tagged: