brunces
05-05-2005, 10:14 AM
Friends,
Before closing the file, I want Excel to automatically organize sheets, putting the cursor in cell "A1" of each of them and activating the first sheet, then I want it to save the workbook.
To do this, I use the code below...
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Sheet5").Select
Range("A1").Select
Sheets("Sheet4").Select
Range("A1").Select
Sheets("Sheet3").Select
Range("A1").Select
Sheets("Sheet2").Select
Range("A1").Select
Sheets("Sheet1").Select
Range("A1").Select
ThisWorkbook.Save
End Sub
Is there any other "easier" way to do this?
Thanks for your attention, guys.
Hugs. :)
Bruno
Before closing the file, I want Excel to automatically organize sheets, putting the cursor in cell "A1" of each of them and activating the first sheet, then I want it to save the workbook.
To do this, I use the code below...
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Sheet5").Select
Range("A1").Select
Sheets("Sheet4").Select
Range("A1").Select
Sheets("Sheet3").Select
Range("A1").Select
Sheets("Sheet2").Select
Range("A1").Select
Sheets("Sheet1").Select
Range("A1").Select
ThisWorkbook.Save
End Sub
Is there any other "easier" way to do this?
Thanks for your attention, guys.
Hugs. :)
Bruno