Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Lucina Ferrrari   on Feb 18 In MS Office Category.

  
Question Answered By: Hababah Younis   on Feb 18

Yes, a single VBA function could certainly return the format  you want
without any intervening cells. Steps you'd need to take:

Pass the original date  as a parameter to the function.

Use the Split function to split it apart at the blanks into a three-element
array.

Use a Case statement to convert Jul to the STRING "07", etc. Do not convert
it to the number 7 or you'll just need to put a leading zero back on it.

Use the Join function to join the bits back up, specifying a hyphen as your
separator.

Return this new string from the function (and therefore into the cell).

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Replace date with a different format in same cell? Or get search suggestion and latest updates.


Tagged: