Deleting contents from cell if text not a number

vron1994

New Member
Joined
Jul 17, 2018
Messages
2
Hi,

I am wanting some code which will loop through a column of text as such:

40
8
Lynton
8
22
Field
2
19B

<tbody>
</tbody>
deleting the cells which do not contain just numbers!

Any help would be appreciated!

Thanks
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi & welcome to MrExcel.
Do you want to delete the cells, or the entire row?
 
Upvote 0
If you want to delete the entire row & your numbers are real numbers try
Code:
Sub c()
Range("A:A").SpecialCells(xlConstants, xlTextValues).EntireRow.Delete
End Sub
Also, if you have blank cells this code will leave them
 
Upvote 0
If you want to delete the entire row & your numbers are real numbers try
Code:
Sub c()
Range("A:A").SpecialCells(xlConstants, xlTextValues).EntireRow.Delete
End Sub
Also, if you have blank cells this code will leave them

Hi, thanks for replying!

I am just looking to clear the contents of the cell, not actually delete anything

Also I am not sure what you mean by real numbers!

Thanks
 
Upvote 0
In that case try this on a copy of your data
Code:
Sub c()
Range("A:A").SpecialCells(xlConstants, xlTextValues).ClearContents
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,871
Members
449,097
Latest member
dbomb1414

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