VBA to clear cells don't have formulas needed !

aysam

Board Regular
Joined
Jun 24, 2009
Messages
224
Office Version
  1. 2010
Platform
  1. Windows
Hi All
I have a large worksheet of about 1000 rows and 200 columns.
It had alot of formulas and a lot of cells to fill in using numbers.
I need a VBA code to clear only the numbers in the cells that don't have formulas.
Is it possible ??
Thanks in advance.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Highlight the entire range of both constants and formula cells; then press F5 to bring up the GoTo Dialog box; Click SPECIAL... Select CONSTANTS, then OK. Press Delete
All the Constants disappear.............
 
Upvote 0
Thanks for the tip.It's Perfect
But
I need a VBA code because my Sheet is designed for Simple EXCEL users.
 
Upvote 0
Thanks for the tip.It's Perfect
But
I need a VBA code because my Sheet is designed for Simple EXCEL users.
Give this macro a try...

Code:
Sub ClearConstantsOnly()
  On Error Resume Next
  Cells.SpecialCells(xlCellTypeConstants).ClearContents
End Sub
 
Upvote 0
Thanks very much. Works well
But
Is it possible to assign a range for the code to work on ?
 
Upvote 0
Thanks very much. Works well
But
Is it possible to assign a range for the code to work on ?
Sure... what range? If you mean you want to select the cells first, then change the word "Cells" in my code to "Selection". If, on the other hand, you want the same specific range everytime, then change the word "Cells" to this...

Range("A1:M123")

where you would use your actual range address for my A1:M123 example.
 
Upvote 0
Thank you very much , Rick
It works very well
That's what I dtreamt
 
Upvote 0

Forum statistics

Threads
1,206,942
Messages
6,075,767
Members
446,153
Latest member
dandee14k

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