View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
belvy123 belvy123 is offline
external usenet poster
 
Posts: 71
Default Macro to select all sheets

Hi
The script works
However I must not be putting it in the right spot
If I put it in say module #1 then it does nothing. If I put it inside a
sheet heading then it runs only when i execute it.
What Am I doing wrong
Thanks
--
crunchin numbers


"Gary''s Student" wrote:

This workbook event macro assumes the reference date in is cell A1 in the
first sheet. If you open the workbook and the reference date is in the
future, nothing happens. If you open the workbook and the reference date is
in the past, then all the cell in the sheets are cleared and the workbook is
saved:

Private Sub Workbook_Open()
Sheets(1).Activate
If Date Range("A1").Value Then
For Each sh In Sheets
sh.Cells.Clear
Next
ActiveWorkbook.Save
End If
End Sub


WARNING: mis-using this macro can be as bad as crossing the streams.
--
Gary''s Student - gsnu200775


"belvy123" wrote:

Hi All

I am needing help with code for a macro
I want to have this macro run on every opening of file and compare to the
current date. If the date is matched or past the current date I want to
select all sheets in the work book and then clear all data in the sheets. And
then save the file also.
Can anyone help with this

Thanks


--
crunchin numbers