View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default End of last month as YYMM

I am looking for a good way to capture the YYMM of the last month
as a string.
My macro runs a monthly process and I would like it to automatically
save to monthly directory labeled by the year and month. If I were to
run it today, 24-May-2007 I would like the result to be YYMM = "0704".


Did you really mean the "last month" as in the one previous May? Assuming
you did...

YourMonth = #24-May-2007#
PreviousMonth = Format$(DateAdd("m",-1,YourDate), "yymm")

Rick