Mark
The following macro saves the workbook under the name of the contents of
cell A1 in the same path as the original file. Note that this message may
wrap the code over 2 lines. The macro consists of the Sub line, the End Sub
line, and only one line in between.
Sub SaveTest()
ActiveWorkbook.SaveAs ActiveWorkbook.Path & "\" & Range("A1").Value &
".xls"
End Sub
You asked also about incrementing the number in A1. I assume you want this
to happen automatically. The code in the macro is a simple one-liner:
Sheets("TheSheetName").Range("A1") = Sheets("TheSheetName").Range("A1") + 1
However, the macro that you put it in depends on when you want the number to
increment. At file opening? At the command to print? At file saving?
Below is the Before_Print macro:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("TheSheetName").Range("A1") = Sheets("TheSheetName").Range("A1")
+ 1
End Sub
Again, watch out for line wrapping.
The above Before_Print macro is a workbook event macro and. as such, must go
in the workbook module. You can access that module by right clicking on the
Excel icon to the left of the word "File" in the menu across the top of the
worksheet, selecting View Code, and pasting the macro into that module. You
can X-out of that to get back to the worksheet.
HTH Otto