Save Macro
Thanks for your response, Bob, but this code will not work because the
Activate method is required to select each sheet.
Sprinks
"Bob Phillips" wrote:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim wrksht As Worksheet
For Each wrksht In ActiveWorkbook.Worksheets
wrksht.Range("A1").Select
Next wrksht
Worksheets(1).Select
End Sub
'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Sprinks" wrote in message
...
I'd like a macro that, prior to saving the current workbook, would
position
the cursor in cell A1, and make the first sheet the active one. The
following code does not work. Can anyone help?
Public Sub SaveWorksheet()
Dim wrksht As Worksheet
For Each wrksht In ActiveWorkbook.Worksheets
Range("A1").Select
Next wrksht
Worksheets(1).Select
ActiveWorkbook.Save
End Sub
Sprinks
|