View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default freezing data in a cell which was obtained using a formula

Place this code into ThisWorkbook (Right click the Excel icon beside File and
select view code)

Private Sub Workbook_Open()
With Worksheets("Sheet1").Range("A1")
If .Value = "" Then .Value = Round(Rnd() * 1000, 0)
End With
End Sub

The code checks to see if there is a Value in Cell A1 on sheet1. If not then
it puts in a random number. If there is a value then it does nothing.
--
HTH...

Jim Thomlinson


"Joe" wrote:

I am using Excel as a form. Upon initial opening of form, I am generating a
Random interger that once generated, I would like to freeze on that excel
sheet
as a tracking # in a cell. My problem is that Excel keep recalculating that
cell each
and every time the spread sheet opens. Is there any way to freeze date in
cell after a formula calculate the initial number?
The excel sheet will be saved individually using that Random interger. This
is to track the Excel sheet forms. Thanks.