close
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 quot;14quot;.

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 quot;14quot;
inserted.
I assumed you want nothing to happen if the day is not the last day of
the month, and you want the quot;14quot; inserted in A1 of a sheet named
quot;TheSheetNamequot;.
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 quot;Filequot; 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 quot;Xquot; 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 quot;14quot; in A1 of the quot;TheSheetNamequot; 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(quot;TheSheetNamequot;).Range(quot;A1quot;) = 14
End Sub
quot;Deanquot; gt; wrote in message
news
gt;I am trying to create a master accrued leave workbook.
gt; I want an action to take place on the last day of each month.
gt; That action is to insert a value of quot;14quot;.
I received a Compile Error, Syntax error.
I changed the TheSheetName to the actual sheet name and I changed the cell
name to H7.
At first I left the double-quotes in, then I took it out.
Both times the same error (Compile Error, Syntax Error) appeared.

quot;Otto Moehrbachquot; wrote:

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

Both the sheet name and the cell address (H7) must be in quotes. Or you
were victimized by line wrap. If this is the case, send me via email a
small file representative of your file. Make sure that the error is present
in the file you send me. My email address is . Remove
the quot;nopquot; from this address. HTH Otto
quot;Deanquot; gt; wrote in message
...
gt;I received a Compile Error, Syntax error.
gt; I changed the TheSheetName to the actual sheet name and I changed the cell
gt; name to H7.
gt; At first I left the double-quotes in, then I took it out.
gt; Both times the same error (Compile Error, Syntax Error) appeared.
gt;
gt; quot;Otto Moehrbachquot; wrote:
gt;
gt;gt; Dean
gt;gt; You don't provide what you want to happen when the day of the month
gt;gt; is
gt;gt; NOT the last day of the month. You also don't say where you want the
gt;gt; quot;14quot;
gt;gt; inserted.
gt;gt; I assumed you want nothing to happen if the day is not the last day
gt;gt; of
gt;gt; the month, and you want the quot;14quot; inserted in A1 of a sheet named
gt;gt; quot;TheSheetNamequot;.
gt;gt; The following macro will do the above. Note that this macro is a
gt;gt; Workbook_Open macro and must be placed in the Workbook module. To do
gt;gt; this,
gt;gt; open the file in which you want this to happen. Right-click on the Excel
gt;gt; icon immediately to the left of the quot;Filequot; in the menu at the top of your
gt;gt; sheet, select View Code, and paste this macro into that module. X-out of
gt;gt; that module (click on the quot;Xquot; in the top right corner of the module) to
gt;gt; return to your worksheet.
gt;gt; This macro will run every time the file is opened. It checks the
gt;gt; system
gt;gt; date and if the day of the system date is the last day of the current
gt;gt; month,
gt;gt; it enters quot;14quot; in A1 of the quot;TheSheetNamequot; sheet. Watch out for line
gt;gt; wrapping in this message. Expand this message to full screen to see the
gt;gt; macro properly.
gt;gt; You probably want more than this so post back. HTH Otto
gt;gt; Private Sub Workbook_Open()
gt;gt; If Day(Date) = Day(DateSerial(Year(Date), Month(Date) 1, 1) - 1)
gt;gt; Then
gt;gt; _
gt;gt; Sheets(quot;TheSheetNamequot;).Range(quot;A1quot;) = 14
gt;gt; End Sub
gt;gt; quot;Deanquot; gt; wrote in message
gt;gt; news
gt;gt; gt;I am trying to create a master accrued leave workbook.
gt;gt; gt; I want an action to take place on the last day of each month.
gt;gt; gt; That action is to insert a value of quot;14quot;.
gt;gt;
gt;gt;
gt;gt;
arrow
arrow
    全站熱搜

    software 發表在 痞客邦 留言(0) 人氣()