Locking information in cells


Posted by Twood on October 22, 2001 1:13 PM

Hi,
I have 'if' statements in a few cells. Depending on the value of a drop down list the cell gets a value, like the sum of a few cells on a different page. I want the value returned when the condition in the 'if'is true to stay in the cell, even if the value in the list changes, causing the condition to be false. How do I do this? Thanks for any help you can give me.

Posted by Jonathan on October 22, 2001 4:47 PM

If the cell is empty to begin with then you can wrap your present procedure in another level of IF. You test whether the cell is empty:

If MyCell.Value = "" Then
' your present procedure goes here
End If

This way, if there's something already in your cell - because the procedure ran already -- then the procedure will not run a second time.

HTH

Posted by Twood on October 23, 2001 3:46 AM

Thanks a lot. I see the logic in the code. My problem is however that I used Excel 'if' statements to evaluate the cell values, not VBA code and the cells update automatically. Any suggestions?




Posted by Jonathan on October 23, 2001 11:45 AM

Only thing I can think of right now is manual: copy the cell and PasteSpecial/Values. Now the cell contains the value but no longer contains the formula that originally produced the value.

HTH