Freeze cells in time!

macke05

New Member
Joined
Aug 17, 2018
Messages
5
Hello,

My question is this: Is there a way to have the values within a set of cells (which have been generated by formulas which use numbers which change often) "locked in" once a certain value is entered (like B12 = 1). So if this task were to be accomplished, when B12 = 1 certain selected cells will not change value again (from what they were when that 1 was entered) despite the formulas linked to them demanding they change.

Thanks!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Not with Excel - "once a formula always a formula"

But can use VBA to achieve this quite easily if value in B12 is amended manually

Right click on sheet tab \ View Code \ Paste this code into the window on the right
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cel As Range: Set cel = Range("B12")
    If Not Intersect(cel, Target) Is Nothing And cel =  1 Then
            Range("E2:E15").Value = Range("E2:E15").Value
    End If
End Sub

{Alt}{F11} takes you back from VBA to Excel

When value in B12 changes to 1, whatever is in E2:E15 become "frozen in time" (all formulas in the range are replaced by the cell value)
 
Last edited:
Upvote 0
So, I altered your code to say:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cel As Range: Set cel = Range("N175")
    If Not Intersect(cel, Target) Is Nothing And cel = 1 Then
            Range("T11:T12").Value = Range("T11:T12").Value
    End If
End Sub

Where N175 is the cell in which 1 is typed in (actually I put an "x" in another cell and a formula types 1 in it) and the range I want "frozen" is T11:T12. But when I changed a value T11 and T12 still changes.
 
Upvote 0
in that case use the other cel as the condition, like this
(replacing N999 with address of other cell)

Code:
    Dim cel As Range: Set cel = Range("[COLOR=#ff0000]N999[/COLOR]")
    If Not Intersect(cel, Target) Is Nothing And cel = "x" Then
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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