View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default This is not working because I didn't write it correctly

Maybe it is because you have fully qualified all objects. Try this

Sub Workbook_Open()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.wks
' pick an employee record to evaluate rather than the master and system
Sheets
With wks
If LCase(.Name) = "master" Or _
LCase(.Name) = "employee census" Or _
LCase(.Name) = "vac&sick" Then
' do nothing
ElseIf .Range("C5").Value DateSerial(2005, 1, 1) Or _
.Range("C5").Value DateSerial(Now - 1, .Range("C5"),
..Range("C5")) Then
' Determine if the employee uses the first of the year or
' if not then determine if the copy should be done or not
If .Range("A99").Value 0 Then
.Range("A7:F34").Copy .Range("A100")
.Range("A8:F34").ClearContents
.Range("A99").Value = 1
End If
End If
End With
Next wks
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"L.White" wrote in message
...
Sorry about that.

To test this I changed the date in my machine to be past the first of next
year. If this were written correctly all people hired before 2005 would

have
had the days off moved to a lower position on their sheet and the main

usage
area blanked. Nothing happened at all.

LWhite

"Bob Phillips" wrote in message
...
What exactly is the problem?

--

HTH

RP
(remove nothere from the email address if mailing direct)