range check

  • Thread starter Thread starter kevin carter
  • Start date Start date
K

kevin carter

hi

is it possible to check a range in vb code ie a1 : a34
if the value in one of the cells is zero i want to turn the value to
space

thanks
 
Hi Kevin
try the following to delete the specific cell values (I assumed that is
what you mean with 'spaces')
sub foo()
dim rng as range
dim cell as range
set rng = activesheet.range("A1:A34")

for each cell in rng
if cell.value = 0 then
cell.clearcontents
' for real spaces use:
'cell.value = " "
end if
next
end sub
 
thanks Frank

Frank Kabel said:
Hi Kevin
try the following to delete the specific cell values (I assumed that is
what you mean with 'spaces')
sub foo()
dim rng as range
dim cell as range
set rng = activesheet.range("A1:A34")

for each cell in rng
if cell.value = 0 then
cell.clearcontents
' for real spaces use:
'cell.value = " "
end if
next
end sub
 
Back
Top