View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach
 
Posts: n/a
Default On the last day of each month, insert a static value

Dean
You don't provide what you want to happen when the day of the month is
NOT the last day of the month. You also don't say where you want the "14"
inserted.
I assumed you want nothing to happen if the day is not the last day of
the month, and you want the "14" inserted in A1 of a sheet named
"TheSheetName".
The following macro will do the above. Note that this macro is a
Workbook_Open macro and must be placed in the Workbook module. To do this,
open the file in which you want this to happen. Right-click on the Excel
icon immediately to the left of the "File" in the menu at the top of your
sheet, select View Code, and paste this macro into that module. X-out of
that module (click on the "X" in the top right corner of the module) to
return to your worksheet.
This macro will run every time the file is opened. It checks the system
date and if the day of the system date is the last day of the current month,
it enters "14" in A1 of the "TheSheetName" sheet. Watch out for line
wrapping in this message. Expand this message to full screen to see the
macro properly.
You probably want more than this so post back. HTH Otto
Private Sub Workbook_Open()
If Day(Date) = Day(DateSerial(Year(Date), Month(Date) + 1, 1) - 1) Then
_
Sheets("TheSheetName").Range("A1") = 14
End Sub
"Dean" wrote in message
...
I am trying to create a master accrued leave workbook.
I want an action to take place on the last day of each month.
That action is to insert a value of "14".