Hi

I have a checkbox that controls the value and behavior of cell D10.

I want to save the cell value to a variable everytime while checkbox is ON and before the checkbox is checked off which then the cell will be locked for edit and cell value becomes a relative large number. And when the checkbox is checked on again, it will bring back the saved value to the cell.

How can I do that? I have got everything else done thanks to a fellow forum contributor.


Formula: copy to clipboard
Private Sub CheckBox1_Click()
Dim con_budg As Long
Dim con_inf As Long

con_inf = 99999

If CheckBox1.Value = True Then Range("D10").Value = con_budg: Range("D10").Locked = False: Call change_normal
If CheckBox1.Value = False Then Range("D10").Value = con_inf: Range("D10").Locked = True: Call change_grey

End Sub

Sub change_grey()

Range("D10").Select
With Selection.Interior
.Pattern = xlSolid
.Color = RGB(217, 217, 217)
End With

End Sub

Sub change_normal()

Range("D10").Select
With Selection.Interior
.Pattern = xlSolid
.Color = RGB(255, 255, 0)
End With

End Sub