View Single Post
  #11   Report Post  
Pank
 
Posts: n/a
Default

Harald,

You must have missed the first part of the post which was:-

The end part of the macro is as follows:-

test
ActiveWorkbook.SaveAs Filename:= _
"Y:\Skip Register\Quarterly Charging Urban Vision Period" & MyQ,
Password:="", _
WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False

Unfortunately, it does not insert the numeric represented by MyQ into the
file name.

ANy Ideas?

Thanks

Pank

"Harald Staff" wrote:

"Pank" skrev i melding
...
'MyQ = 1 + Int(Month(DateSerial(Year(Date), Month(Date) - 1, 1)) / 4)

Can you please clarify whether the digit 4 is correct or should it be 3 to
represent quarters (i.e. every 3 months)?


Doh ! Really sorry about that. This is more like what I intended:

MyQ = 1 + Int((Month(DateSerial(Year(Date), Month(Date) - 1, 1)) - 1) / 3)

it will return for each month
jan 4
feb 1
mar 1
apr 1
may 2
jun 2
jul 2
aug 3
sep 3
oct 3
nov 4
dec 4
but it may not be what you wanted.

Best wishes Harald