Finding Formula and clearing cell

RussD

New Member
Joined
Apr 13, 2003
Messages
16
I need some help in writing a macro that finds a cell within a column that has a formula. I need to find the formula and then clear it.

Thanks. :oops:
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
Hi Russ:

Here is one to try ...
Code:
Sub yFindAFormulaInCellA1toA12andClearIt()
    For Each cell In [A1:A12]
        If cell.HasFormula Then cell.ClearContents
    Next cell
End Sub
 

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
hi!
If you mean clear it, delete the formula then try this.
select the range in concern and run the macro.


<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> delFormula()
For <SPAN style="color:#00007F">Each</SPAN> c <SPAN style="color:#00007F">In</SPAN> Selection
    <SPAN style="color:#00007F">If</SPAN> c.HasFormula = <SPAN style="color:#00007F">True</SPAN> <SPAN style="color:#00007F">Then</SPAN>
        c.ClearContents
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">Next</SPAN> c
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
 

RussD

New Member
Joined
Apr 13, 2003
Messages
16
Thanks for both of you! I'll give these a try at work tomorrow.

Cheers,

Russ D.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,416
Messages
5,596,010
Members
414,037
Latest member
Roamingsmile

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
Top