freezing data in a cell which was obtained using a formula

J

Joe

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.
 
J

Jim Thomlinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top