I want it to run automatically so formula or VBA I am not bothered :} just as long as the date/time is applicable to that day (hence why I CANNOT use Now() otherwise it will mess up the daily/weekly stats.
I don't think you are understanding the clarification I am making here.
Note, that using Now() or Date in VBA is NOT necessarily the same as using those functions directly on the worksheets. By using it in VBA, you can return just the value, which "hard-codes" it into the cell, unlike using the function directly into the cell on the worksheet, which will be constantly changing.
Putting:
=NOW()
in a cell returns the current date/time in any cell. But the issue, as you see, is that it always returns the current date/time, so it is constantly changing (it is not static).
However, doing something like this in VBA:
Code:
Sub Test()
Range("A1") = Now()
End Sub
puts a permanent date/time stamp in cell A1 (that does NOT change; it is hard-coded).
So VBA is probably the route we want to go.
I want it to run automatically
OK, now that we have that established, we need to determine what exactly is going to trigger the VBA code to run. Typically, it is on events like:
- the opening of the file
- the change in the value of particular cells
I am thinking that you are probably leaning towards the second option listed above, but it needs to be defined more clearly, exactly:
- what is changing
- how is it changing
- when it it changing
If it is a manual change directly to a cell, that is pretty easy to do. However, your cells are formulas, not hard-coded values that are being changed.
We need to look at how the data being returned by those formulas is changing. It looks like the formulas are using values from columns A and G on your
testdata sheet.So, please answer the following questions:
- What is in columns A and G on your testdata sheet (more formulas or hard-coded values)?
- How are those values in columns A and G on your testdata sheet being changed?
- When are those values in columns A and G on your testdata sheet being changed?
Can you answer those three questions?
Also, another question that we need answered is the following:
- Is this date/time that you want updated ONLY in row 2, or are there multiple rows of data?
- If there are multiple rows of data, is the data from row 3 pulling from row 3 of your testdata sheet, and row 4 pulling from row 4 of your testdata sheet, etc?