Issue with formula in Cell not saving after making changes

creaseA

New Member
Joined
Mar 20, 2023
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Hello all, first post here.

I am having an issue with excel not saving a new formula in specified cells. Here is some background:

Within the cells of my workbook: certain cells have the following function contained in the cell: =function_name(data1,data2,data3,etc........)

I made edits to the VBA code called "function_name" which requires me to adjust the cell input to the following: =function_name(data1,data X,data2,data3,etc........)
where "data X" is a new value I pass to the cell.

When I make the change to add the cell containing " Data X" it works fine. When I save and refresh my workbook this change does not get saved and I have to re-add data X to the cell every time I want to run the function.....

How do I make this change permanent?

Thanks!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi & Welcome to MrExcel.


Just make sure that you have calculation option marked as automatic under formula tab

1679336084851.png
 
Upvote 0
Hi & Welcome to MrExcel.


Just make sure that you have calculation option marked as automatic under formula tab

View attachment 87941
The calculation iption is automatic and the issue still occurs. This function exists in a table and that table has a "clear table" macro attached. Could this be causing an issue? Every input into the table I have to forcibly add "data X" as to not get an error
 
Upvote 0
Sorry, I am not much familier with vba and macro, so I can't help if it is related to it.
 
Upvote 0
To update this thread: I have discovered that it is indeed the macros I have running that is causing this error. The macros I have running clears all previous data within the row the a table. However, it also reverts the change I made to the formula back to the previous formula. Is there a specific issue causing this? This part of the code was not written or recorded by me so I am not super familiar with it (fairly new to VBA language).
 
Upvote 0
To update this thread: I have discovered that it is indeed the macros I have running that is causing this error. The macros I have running clears all previous data within the row the a table. However, it also reverts the change I made to the formula back to the previous formula. Is there a specific issue causing this? This part of the code was not written or recorded by me so I am not super familiar with it (fairly new to VBA language).
Second update. I have discovered I line of code within the clearing macro that forcibly re-instates the function the to cell in which it was cleared. (The reason this took so long is that the table is extensive.)

My question is now: Is there a way around this? It seems extremely tedious (credit to the original author for the mass of equations they did this for) to have to hard code the equation back into the cell after the cell was cleared. (The used Cells(row,col).Value = "")

Would something like .ClearContents work better and clear the contents but not the formula?

Thanks,

-Aidan
 
Upvote 0
Solution
No, a formula is a content and so ClearContents will remove it
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top