Subtract 1 from Each Number in Column

A

ani

I have a column of quantities in excel and I want to subtract 1 fro
each of these numbers, unless the number is already zero. Any idea ho
to do that?

Thanks
 
T

Tom Ogilvy

for each cell in selection
if isnumeric(cell.Value) then
if cell.Value > 1 then
if not cell.Hasformula then
cell.Value = cell.Value - 1
end if
end if
End if
Next


or

set rng = Selection.SpecialCells(xlConstants,xlNumbers)
for cell in rng
if cell.Value > 0 then
cell.Value = Cell.Value - 1
end if
Next
 
Top