Loops

G

Guest

I need a loop function in excel... is there such a thing?
What I need is for excel to look over a range of cells and
if there is data written in the cells to increment a
counter and if it is blank to not increment and move on to
the next cell. If I were programming in C I would use a
FOR loop but I can't find any loops in the excel function
list. Please help me out... thanks
 
F

Frank Kabel

Hi
not really sure what you're trying to do but in the VBA
help look for
'for next'
'for each'
'do while'

in your example you may use something like

dim rng as range
dim cell as range
set rng = range ("A1:A10")
for each cell in rng
'do your stuff
next
 
M

Mark Graesser

Hi anonymous
If you just want to count the non-blank cells then use the COUNTA function. If you truely want to run a loop then you have to use VBA. Functions can only perform calculations

Good Luck
Mark Graesse
[email protected]
Boston M

----- [email protected] wrote: ----

I need a loop function in excel... is there such a thing?
What I need is for excel to look over a range of cells and
if there is data written in the cells to increment a
counter and if it is blank to not increment and move on to
the next cell. If I were programming in C I would use a
FOR loop but I can't find any loops in the excel function
list. Please help me out... thank
 
G

Guest

you Rule! thanks

-----Original Message-----
Hi anonymous:
If you just want to count the non-blank cells then use
the COUNTA function. If you truely want to run a loop
then you have to use VBA. Functions can only perform
calculations.
 
Top