can I clear a cell's contents and retain the formula in that cell?

keithmct

Active Member
Joined
Mar 9, 2007
Messages
256
Office Version
  1. 2021
Platform
  1. Windows
I have a range of cells on one input sheet that is automatically copied over to an order form. Formula in order form cells is =Home!E14 etc.
Now that we have 2 suppliers I need to remove (clear contents of that row or range) orders on the order form, column J, that starts with JPM, but clearing contents deletes the formula =Home!E14
any ideas?
I've looked at Go To Special which doesn't apply as far as I can tell.
I've used this code:

https://www.rondebruin.nl/win/s4/win001.htm

from Ron De Bruin which deletes the rows but then I'd have to add back rows with formulas in them to my order template for other things to work properly.
I'm pretty stumped at this stage.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
If you clear the contents at Home!E14, then the formula will result in NULL.

So no, you can't clear the cell with a formula and have it retain the formula.
 
Upvote 0
I dont want to clear Home!E14, I want to clear the cell on the order form that looks at Home!E14 and duplicates the value there. Then I run some sort of code to remove the unwanted stuff from the order form sheet & the next time I use the spreadsheet it all has to go back to normal again.
 
Upvote 0
You can't clear a cell and retain a formula. By the sound of it you either need to use code to replace the formula or look at setting up the order form as a template.
 
Upvote 0

Forum statistics

Threads
1,223,956
Messages
6,175,616
Members
452,661
Latest member
Nonhle

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