Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Macro triggered by date

At the beginning of each month, I need to copy/paste value over a number of
formulas so the results become fixed. I know how to automate the process
using the recorder, but want it to do it automtically when the 1st of the
month comes. I'm sure I can do that by making reference to a today()
formula, but don't know how to write the code. My apoligies if this was
already posted somewhere, as I couldn't find the exact info I was looking for.

Regards,

Lonpuz
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro triggered by date

Hi Lonpuz

You can use the workbook open event in the thisworkbook module
http://www.rondebruin.nl/code.htm

Private Sub Workbook_Open()
If Day(Date) = 1 Then

' Your code

End If
End Sub

If you not open the file on the first day it will not run the code
If you open the file two times on day 1 then it will run two times so you must build in a few checks

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Lonpuz" wrote in message ...
At the beginning of each month, I need to copy/paste value over a number of
formulas so the results become fixed. I know how to automate the process
using the recorder, but want it to do it automtically when the 1st of the
month comes. I'm sure I can do that by making reference to a today()
formula, but don't know how to write the code. My apoligies if this was
already posted somewhere, as I couldn't find the exact info I was looking for.

Regards,

Lonpuz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Macro triggered by date

If Day(Date) = 1 Then
Call myMacro
End If

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Lonpuz" wrote in message
...
At the beginning of each month, I need to copy/paste value over a number
of
formulas so the results become fixed. I know how to automate the process
using the recorder, but want it to do it automtically when the 1st of the
month comes. I'm sure I can do that by making reference to a today()
formula, but don't know how to write the code. My apoligies if this was
already posted somewhere, as I couldn't find the exact info I was looking
for.

Regards,

Lonpuz



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Macro triggered by date

I will give that a try later today and let you know how it works. I will
assume that in your example, when it says "= 1", I can make a cell reference.

THANK YOU for your speedy replies!

Regards,

Lonpuz
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Macro triggered by date

Tried to setup the month of February. Here is my macro;

Private Sub Workbook_Open()
If Day(Date) = 39479 Then
' FixFeb Macro
' Macro recorded 18/01/2008 Fixes Feb formula to values
'

'
Sheets("Feb Accounts").Select
ActiveWindow.SmallScroll Down:=-27
Range("D9:D177").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("F9:F177").Select
Range("F177").Activate
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("G9:H9").Select
End Sub

Basically I want to tell it that if it is Feb 1, to copy paste two columns
of data as values. That's it.
With this macro, I get an error. It says"Compile error: Block If without
End If"
Any ideas?
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
referring to the button that triggered the macro [email protected] Excel Programming 2 December 11th 07 09:10 AM
Automatic copy triggered by change in date Xerxes Excel Worksheet Functions 1 November 23rd 07 11:04 AM
Macro triggered by an event Mekinnik Excel Programming 3 October 1st 07 07:46 PM
Can a macro be triggered when a cell is selected? Linking to specific cells in pivot table Excel Programming 2 July 12th 05 07:28 AM
Macro triggered by an event AussieAVguy Excel Discussion (Misc queries) 2 June 16th 05 05:51 AM


All times are GMT +1. The time now is 09:51 AM.

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"