View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Alter data or start macro from a date formula

I would recommend using the on change event to fire the existing macros
something like this...

Private Sub Worksheet_Change(ByVal Target As Range)
if target.address = "$A$1" or target.address = "$A$2" then _
Call MyMacro()
End Sub

With this code if either cells A1 or A2 are changed then MyMacro is called.
This code needs to be inserted into the sheet with the dates on it. (Right
click the tab and select view code). All you need to do is change the cell
references and "MyMacro" and you are off to the races...
--
HTH...

Jim Thomlinson


"DavidM" wrote:

At present when I change the start date in one cell and end date in another
cell the number of weeks difference between the dates is automatically worked
out by a formula in yet another cell.

I have recorded macros to alter data in different sheets of the workbook
according to the number of weeks difference. But I would like to do it
automatically on entering the dates.