ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If Len 5 OR cell is alphanumeric Then Clear contents (https://www.excelbanter.com/excel-programming/376790-if-len-5-cell-alphanumeric-then-clear-contents.html)

[email protected]

If Len 5 OR cell is alphanumeric Then Clear contents
 
Hi there

I've got a macro that doeas a whole load of formatting for me, I'm just
after a final statement that'll look at all the cells in the active
worksheet and clears the contents of the cell if the length is less
than 5 OR there are alphabetic characters mixed with the numbers.

Thanks


Bob Phillips

If Len 5 OR cell is alphanumeric Then Clear contents
 
For Each cell In ACtivesheet.UsedRange
If Len(cell.Value) < 5 Or _
Not (IsNumeric(cell.Value) Then
cell.ClearContents
End If
Next cell

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ps.com...
Hi there

I've got a macro that doeas a whole load of formatting for me, I'm just
after a final statement that'll look at all the cells in the active
worksheet and clears the contents of the cell if the length is less
than 5 OR there are alphabetic characters mixed with the numbers.

Thanks





All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com