Excel VBA - Rounding highlighted cells

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
 
F

Frank Kabel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top