Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / December 2005

Tip: Looking for answers? Try searching our database.

On the last day of each month, insert a static value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dean - 14 Dec 2005 03:46 GMT
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".
Otto Moehrbach - 14 Dec 2005 13:28 GMT
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
>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".
Dean - 14 Dec 2005 16:20 GMT
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.

> Dean
>     You don't provide what you want to happen when the day of the month is
[quoted text clipped - 24 lines]
> > I want an action to take place on the last day of each month.
> > That action is to insert a value of "14".
Otto Moehrbach - 14 Dec 2005 19:10 GMT
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 ottokmnop@comcast.net.  Remove
the "nop" from this address.   HTH   Otto
>I received a Compile Error, Syntax error.
> I changed the TheSheetName to the actual sheet name and I changed the cell
[quoted text clipped - 37 lines]
>> > I want an action to take place on the last day of each month.
>> > That action is to insert a value of "14".
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.