View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Sub to clear cells with zeros or null strings within a selected ra

Hi Max -

Although VBA variables can evaluate to "Null", worksheet cells cannot. A
cell is considered empty if it evaluates to a zero-length string (zls),
designated as "". So the procedure below sets cells in the selection to ""
if they containing a zero or spaces only.

Sub MaxSingapore()
Set rng = Selection
For Each itm In rng
If Trim(itm.Value) = "" Or itm.Value = 0 Then itm.Value = ""
Next 'itm
End Sub
--
Jay


"Max" wrote:

Hi guys,

I'm looking for a sub to clear cells with zeros or null strings within a
selected range. I'd select the range, then run the sub to clear all such
cells within the range. Thanks for insights.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---