View Single Post
  #1   Report Post  
Pank
 
Posts: n/a
Default Formula for current month minus one = Quarter number in a macro.

I have a macro that does several things. The last step should be to save the
file to a network drive with a name and quarter number appended to it.

The file save command I have got is: -

ActiveWorkbook.SaveAs Filename:= _
"Y:\Skip Register\Quarterly Charging Period ?", FileFormat:=xlExcel9795, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
CreateBackup:=False

The ? in the file name should be substituted by the formula as described
below.

The macro is to be run in the month following a quarter (i.e. run macro in
April to get Quarter number to 1, run macro in July to get Quarter number to
2, run macro in October to get Quarter number to 3, run macro in January to
get Quarter number to 4).

How can enter effectively enter a formula in a macro which is along the
lines of ((current month €“ 1)/3)). If current month €“ 1 = 0 then set current
month to 12 and undertake the calculation again.

Any help offer is most appreciated.

Thank You

Pank

Lastly, if my version of Excel is 2000, should I substitute 2000 in place of
9795 in the file format above?