View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default examine value, leave it or increment it

increment each cell within that range?
or increment the total?
i believe you mean each cell

something like this would work (not tested)

sub ivano()

dim c as range
dim myrange as range
dim ivalue as integer
dim ws as worksheet

set ws = activesheet
set myrange = ws.range("a1:a10")

for each c in myrange
ivalue = c 'this might need to be c.value
if ivalue <= "5" then
'do nothing
else
ivalue = ivalue+1
end if
next c

end sub

hope it helps!
susan




On May 1, 1:21 pm, Ivano wrote:
Hi,
I want a macro that will examin cells within range A1 to A10 and if it is
equal to or less then 5 leave it alone else increment it by one.

Thanks
Ivano,