Need macro to delete all text cells in an Excel range

G

GVT

When I import a table from another program into Excel, the blank cells in the
original program look blank, but Excel imports them as text. I need help
writing a macro that will identify the cells that contain text and delete
their contents.
 
G

Gary''s Student

Enter:


Sub textclear()
' gsnu
Dim r As Range
For Each r In Selection
If r.Application.IsNumber(r.Value) Then
Else
r.Value = ""
End If
Next
End Sub

Select an area of the worksheet and run the macro.
 
K

Ken Wright

Use Dave McRitchies Trimall macro, and it will do a lot more besides:-

http://www.mvps.org/dmcritchie/excel/join.htm#trimall

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------­------------------------------­----------------
It's easier to beg forgiveness than ask permission :)
------------------------------­------------------------------­----------------
 
Top