How to reference a cell value each day

ddub25

Well-known Member
Joined
Jan 11, 2007
Messages
625
Office Version
  1. 2019
Platform
  1. Windows
In A1 I have a balance that is constantly fluctuating depending on transactions that I process on other parts of the spreadsheet.

Is it possible to, lets say, have B1 read this value on Monday and fix/freeze at this value, and then B2 do they same for Tuesday, B3 for Wednesday and so forth?

The reason why, is that I want to output the changes in balance over a period of time into a chart.

Ideally I would have each new change in balance recorded rather than just recording at the start of each new day, but I imagine this might be something to do in Visual Basic. If it is, can anyone point me to a good resource on Visual Basic for doing this sort of thing?

Dan
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi,
In the vba editor go to the sheet1 module not a new one. insert code as such (changing as needed)

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim KeyCells As Range
    ' The variable KeyCells contains the cells that will
    ' cause an alert when they are changed.
    Set KeyCells = Range("A1")
    
    If Not Application.Intersect(KeyCells, Range(Target.Address)) _
           Is Nothing Then
         ' Place your code here.

thisworkbook.sheets("Sheet1").range("B"&range).value =  thisworkbook.sheets("Sheet1").range("A1").value
        
       
    End If

End Sub

can put code to check if b2 or b3 has a value in the workbook open event in workbook module and change the B value.
eg:

Code:
Private Sub Workbook_Open()
if thisworkbook.sheets("Sheet1").range("B2").value <> "" then
range = 3
else 
range = 2
end if
 
End Sub

range would be a global variable or can use a non changing cell on worksheet. you would need to modify the above, let me know if you wish more help
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,862
Members
452,948
Latest member
UsmanAli786

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