Excel VBA - Rounding highlighted cells

  • Thread starter Thread starter robert cohen
  • Start date Start date
R

robert cohen

Is there a macro that can be used to round, say to 2 decimal places,
number of highlighted cells, say a column
 
Hi
you may try the following code:

sub foo()
dim rng as range
dim c as range
set rng = selection
for each c in selection
if IsNumeric (c.value) then
c.value = Round(c.value,2)
end if
next
end sub

Highlight your column and invoke this macro
 
Back
Top