View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
BorisS BorisS is offline
external usenet poster
 
Posts: 191
Default code for counting/shifting

what does the resize part do, just for my education?

Thx for the help to all.
--
Boris


"Tom Ogilvy" wrote:

Dim rng as Range, cell as Range, cnt as Long
set rng = activecell.offset(0,1).Resize(1,10)
cnt = application.countA(rng)
for each cell in rng
if len(trim(cell.value)) 0 then
cell.Select
myprocedure
end if
Next

--
Regards,
Tom Ogilvy


Assumes your procedure acts on the active cell. or just write your code to
work with the range reference: cell (and skip the select command)

--
Regards,
Tom Ogilvy


"BorisS" wrote:

I need some code to do the following:

1) start with a given cell
2) count how many of the 10 cells to the right of it are filled with data
3) for each of those cells, perform a small procedure

My hangup right now is how to get the loop structured, as I always screw up
the definitions of variables, as well as how to use them in code. So if
anyone can give me the first part of this, I can fill in the procedure
inbetween the loop beginning and ending arguments.

Thx.
--
Boris