vba to blank cells with criteria

wigarth

Board Regular
Joined
Apr 16, 2016
Messages
51
Office Version
  1. 365
Platform
  1. Windows
Hi!

I am sure there is a 10 line easypeasy macro to solve my issues here...
The problem is that I (and google) lack the expertise to find it.

I have a sheet with a column ("D") and it has some cells that needs to be blanked.
The cells that are to be "Blanked" are cells contaning "numbers only"
The cells to keep, contains only text or numbers and text in the same cell.


So basically i need to make a macro that loops throgh area D1:D100000 and blank out cells that contains only numbers and skips the ones containing text/text and numbers
With the word "Blanked" I mean "" (Make the cell empty, not hide/delete it)


In exaple:

Cell D12 ---> "17551" <-- make this cell blank, replace with ""
Cell D13 ---> "Product12" <-- Skip this cell
Cell D14 ---> "Region8" <--- Skip this cell
Cell D15 ---> "64665" <-- make this cell blank, replace with ""
Cell D16 ---> "4th annual summary" <-- Skip this cell
Cell D17 --->"323" <-- make this cell blank, replace with ""

I have several macros that can remove numbers, but they remove the numbers from the cells that contain text as well... Anyone with some advice here?

Best reggards:
Wigarth
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try:
VBA Code:
Sub try333()
Range("D1:D100000").SpecialCells(xlConstants, xlNumbers).ClearContents
End Sub
 
Upvote 0
Solution
Try:
VBA Code:
Sub try333()
Range("D1:D100000").SpecialCells(xlConstants, xlNumbers).ClearContents
End Sub
I stand corrected... 1 line to solve it all... Thanks Loads for this one Akuini!
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,961
Latest member
nzskater

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