ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving Data (https://www.excelbanter.com/excel-programming/297839-saving-data.html)

ceplane[_3_]

Saving Data
 
I have triied to use the following code to save entered data. Howeve
it also deletes all the formulas in cells not used yet. I'm triing t
save data as it is entered. Once the data is entered the formula i
not need for that cell. However, future data is depended on th
formula in other cells not used yet. ??????


Sheet2.Activate
Set rng = Range("A3:E366")
If rng 0 Then
rng.Formula = rng.Value
Else
rng.Formula = rng.Formula
End If


Thank you again

--
Message posted from http://www.ExcelForum.com


Simon Lloyd[_442_]

Saving Data
 
You could try Activesheet.Save....i'm pretty new to this so dont kno
how it would work but for it to work when a change is made on a shee
it would have to e in Private Sub Worksheet_sheetselection_change.

HTH

SImo

--
Message posted from http://www.ExcelForum.com


Gord Dibben

Saving Data
 
ceplane

Sheets("Sheet6").Activate
Set rng = Range("A3:E366")
For Each rcel In rng
If rcel.Value 0 Then
rcel.Formula = rcel.Value
Else
rcel.Formula = rcel.Formula
End If
Next rcel


Gord Dibben Excel MVP


On Mon, 10 May 2004 14:10:24 -0500, ceplane
wrote:

I have triied to use the following code to save entered data. However
it also deletes all the formulas in cells not used yet. I'm triing to
save data as it is entered. Once the data is entered the formula is
not need for that cell. However, future data is depended on the
formula in other cells not used yet. ??????


Sheet2.Activate
Set rng = Range("A3:E366")
If rng 0 Then
rng.Formula = rng.Value
Else
rng.Formula = rng.Formula
End If


Thank you again.


---
Message posted from http://www.ExcelForum.com/



ceplane[_4_]

Saving Data
 
Thank you for the ideas.
But, she hangs up on

If rcel.Value 0 Then

Doesn't look much different then what I triied before.
Sounds simple I can't get it to work.

The active sheet save didn't work either. ?????

--
Message posted from http://www.ExcelForum.com


Gord Dibben

Saving Data
 
What is "hangs up"?

Looks much different from your original code and changes formulas to values if
they return something. Leaves formulas as is if they return nothing.

As far as saving the Activesheet, I don't see that anywhere in your original
code.

Here is a simple Macro for saving the active worksheet
with the sheet name as the file name.

Sub SaveSheet()
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:=ActiveSheet.Name, _
FileFormat:=xlNormal
End Sub

Gord



On Mon, 10 May 2004 20:33:49 -0500, ceplane
wrote:

Thank you for the ideas.
But, she hangs up on

If rcel.Value 0 Then

Doesn't look much different then what I triied before.
Sounds simple I can't get it to work.

The active sheet save didn't work either. ??????


---
Message posted from http://www.ExcelForum.com/



ceplane[_5_]

Saving Data
 
Gord,
When the program runs, I get an error message "Runtime Error 13 Typ
mismatch" and this line is highlighted.

If rcel.Value 0 Then

I don't know if it is the cell format that is causing the problem o
not.

Thanks for your support.
Ric

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 02:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com