Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dean
 
Posts: n/a
Default On the last day of each month, insert a static value

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".
  #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".



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

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.

"Otto Moehrbach" wrote:

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".




  #4   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

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 "nop" from this address. HTH Otto
"Dean" wrote in message
...
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.

"Otto Moehrbach" wrote:

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".






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help!!! Vlookup!! theukego Excel Worksheet Functions 3 November 13th 05 05:01 PM
how do I insert the current time (static) and date in a cell? DF Excel Discussion (Misc queries) 5 October 28th 05 05:54 PM
How to extract month number from month name PM Excel Discussion (Misc queries) 2 January 19th 05 03:07 PM
Challenging Charting C TO Charts and Charting in Excel 0 January 17th 05 06:57 PM
Insert Month and Year in my worksheet Myrna Excel Worksheet Functions 1 November 8th 04 01:29 AM


All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"