ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Convert formula to value based upon date (https://www.excelbanter.com/excel-discussion-misc-queries/56099-convert-formula-value-based-upon-date.html)

mp

Convert formula to value based upon date
 
Here is what I want to do:
Cell1 references Cell2. Cell2 is a number that is pulled from another
worksheet. The value in Cell2 can change based upon new information entered
into the other worksheet. Cell1, however, should retain the old information
from Cell2 if TODAY() is than the date at the top of the column in which
Cell1 resides. If TODAY() is < than that date Cell1 should update. I'm
really not sure how to make this happen! Help much appreciated. I've
thought about enabling manual recalculation, but this won't work for other
reasons.



Dave Peterson

Convert formula to value based upon date
 
I think I'd use an event macro that fires each time the worksheet recalculates.

If you want to try, rightclick the worksheet tab with cell1, cell2, and the date
cell on it. Select View code and paste this into the code window.

Option Explicit
Private Sub Worksheet_Calculate()

Dim Cell1 As Range
Dim Cell2 As Range
Dim DateCell As Range

Set Cell1 = Me.Range("a2")
Set Cell2 = Me.Range("b2")
Set DateCell = Cell1.EntireColumn.Cells(1)

If Date DateCell.Value Then
'do nothing
Else
Cell1.Value = Cell2.Value
End If

End Sub

Then close this window and back to excel and try it out (by changing the cell
that cell2 uses) (and the date cell, too.)



mp wrote:

Here is what I want to do:
Cell1 references Cell2. Cell2 is a number that is pulled from another
worksheet. The value in Cell2 can change based upon new information entered
into the other worksheet. Cell1, however, should retain the old information
from Cell2 if TODAY() is than the date at the top of the column in which
Cell1 resides. If TODAY() is < than that date Cell1 should update. I'm
really not sure how to make this happen! Help much appreciated. I've
thought about enabling manual recalculation, but this won't work for other
reasons.


--

Dave Peterson

mjp

Convert formula to value based upon date
 

Thank you. I'll give that a try!


--
mjp
------------------------------------------------------------------------
mjp's Profile: http://www.excelforum.com/member.php...o&userid=28876
View this thread: http://www.excelforum.com/showthread...hreadid=486117


mjp

Convert formula to value based upon date
 

This blanks the cell that I'm trying to preserve when it is supposed to
'do nothing! Suggestions?


--
mjp
------------------------------------------------------------------------
mjp's Profile: http://www.excelforum.com/member.php...o&userid=28876
View this thread: http://www.excelforum.com/showthread...hreadid=486117



All times are GMT +1. The time now is 10:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com