Timestamp data daily

Rexy69

New Member
Joined
Apr 28, 2015
Messages
16
Hi, i have a spreadsheet which calculates total profit and there is a cell which has my total profit in, i basically want a sheet in my spreadsheet to read the total profit cell and put a date next to it when the workbook is opened (this may have to be VBA or a macro or something, or maybe its not possible.

i was thinking a vlookup on todays date (Today()) but then the data wont stay when it moves to the next date.

Example of what i am after

when i open the workbook on the 01/01/2019, 02/01/2019, 03/01/2019, 05/01/2019

i want the following to save:
Profit Date
£3000 01/01/2019
£3500 02/01/2019
£3750 03/01/2019
£4100 05/01/2019

can this be done automatically, i have tried searching online but i don't really know what to search so have found nothing similar.

any help would be appreciated

Many Thanks

Rexy~
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Place this macro in the code module for ThisWorkbook. Do the following: Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the left hand pane, double click on "ThisWorkbook". Copy/paste the macro into the empty window that opens up. This macro assumes you have a sheet named "Summary". It also assumes that the total profit is in cell A1 of "Sheet1". Change these in the macro to suit your needs. Close the window to return to your sheet. Save the workbook as a macro-enabled file, close it and then re-open it.
Code:
Private Sub Workbook_Open()
    Sheets("[COLOR="#FF0000"]Summary[/COLOR]").Cells(Sheets("[COLOR="#FF0000"]Summary[/COLOR]").Rows.Count, "A").End(xlUp).Offset(1, 0) = Sheets("[COLOR="#0000FF"]Sheet1[/COLOR]").Range("[COLOR="#0000FF"]A1[/COLOR]").Value
    Sheets("[COLOR="#FF0000"]Summary[/COLOR]").Cells(Sheets("[COLOR="#FF0000"]Summary[/COLOR]").Rows.Count, "B").End(xlUp).Offset(1, 0) = Date
End
Sub
 
Upvote 0
Hi sorry for the late reply i am getting an error when i try and open the workbook

"Compile Error :
Syntax Error"

this is the code i used : (i made a seperate sheet called "Test" to try it out on and the profit figure is in the Account Summary sheet in cell c16)

PHP:
Private Sub Workbook_Open()    
Sheets("Test").Cells(Sheets("Test").Rows.Count, "A").End(xlUp).Offset(1, 0) = Sheets("Account Summary").Range("C16").Value
Sheets("Test").Cells(Sheets("Test").Rows.Count, "B").End(xlUp).Offset(1, 0) = Date
End
Sub


Thanks

Rexy69
 
Last edited:
Upvote 0
Not sure if it is just because you used php tags rather than code tags but all I can see wrong is Sub from End Sub is on the wrong line. Should be

Code:
Private Sub Workbook_Open()
Sheets("Test").Cells(Sheets("Test").Rows.Count, "A").End(xlUp).Offset(1, 0) = Sheets("Account Summary").Range("C16").Value
Sheets("Test").Cells(Sheets("Test").Rows.Count, "B").End(xlUp).Offset(1, 0) = Date
End Sub
 
Upvote 0
Not sure if it is just because you used php tags rather than code tags but all I can see wrong is Sub from End Sub is on the wrong line. Should be

Code:
Private Sub Workbook_Open()
Sheets("Test").Cells(Sheets("Test").Rows.Count, "A").End(xlUp).Offset(1, 0) = Sheets("Account Summary").Range("C16").Value
Sheets("Test").Cells(Sheets("Test").Rows.Count, "B").End(xlUp).Offset(1, 0) = Date
End Sub

haha yeah that was it my fault !!

thanks
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top