Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set value for calculated date once and then act as hard-coded value 1

Status
Not open for further replies.

alexisb

Programmer
Apr 5, 2001
100
US
I used VBA in Excel to calculate an expiration date for a spreadsheet, using OnTime. I only need to run the OnTime logic once and then I cancel it right away using Schedule=:false. That all works fine and I get the value I want. The problem is that every time I open the spreadsheet, the value recalculates because it doesn't see that I already set my value, expdate. Is there a way for me to keep this value in the spreadsheet after I set it the first time. It would be equivalent to hard-coding the value expdate to "3/31/06" except that I calculated it the first time the sheet is opened.

I hope this makes sense.

Thanks,
Alexis
 
You don't say what is in the cell right now (what shows in the formula bar).

But
[COLOR=blue white]range("A1").value = range("A1").value[/color]
will convert whatever is in that cell to a static number.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Thanks, John. I am an Access/VBA progmmer and have only dabbled in Excel VBA. I didn't even think to store the value on the sheet and then check for it being non-blank when the sheet is opened. I have modified my code to do that and it works fine now.

Thank you so much.
Alexis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top