Forum Discussion
record data from a specific cell at the same time once per day?
- May 09, 2021
The problem was that the code used different worksheet names.
I have given cell Z129 on Sheet1 the name CurrenPercentage. If you insert or delete rows above it, or columns to the left of it, Excel will automatically adjust the definition of the name. The code now uses the name instead of the literal address Z129.
(I took the liberty to change some date formulas on Sheet1 to hide errors)
If you want Sheet 3 to be updated automatically after midnight, you'd have to keep the computer on, Excel running and the workbook open 24 hours a day. Or would it be OK to update Sheet 3 when the workbook is opened, or when you activate Sheet 3? Or click a button to update it?
- Greg_Prophet1234May 09, 2021Copper Contributor
HansVogelaar I think if it updated when you turned on the computer or opened the excel workbook and it updated then that would be awesome. I'd prefer not to have to click a button but everyday to update it. It also doesn't have to be an exact time but just used midnight as an example as I didn't want data collected everytime the cell changes percent availability as this would be maybe 10 times per day but rather once per day, a snapshot to compare one day to the next. It would be ideal if it were the same time everyday, and perhaps midnight so at days end whatever that percentage available would be the snapshot of the day and start the new day.
- HansVogelaarMay 09, 2021MVP
See the attached sample workbook. It is a macro-enabled workbook, so you will have to allow macros when you open it.
The first time it is opened on a day, the Workbook_Open event procedure in the ThisWorkbook module will enter the previous day in column A in the next available row of Sheet 3, and the current value of Z129 (which should be the value it was at the end of the previous day) on Sheet 1 in column B.
If the workbook is reopened later on the same day, nothing will happen.
- Jesse985Sep 26, 2021Copper ContributorHi there. Just wanna ask on How to make it record the latest update on the same day. Like for example in the morning it was 65% then became 87% in the afternoon. Your vba i try to use. Thank u