Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help: Loop code in excel

Status
Not open for further replies.

Walshie1987

Technical User
Oct 5, 2006
100
Hi, I am wanting to do the following, how would I put it into code please?

if cell a1 = (few calculations) then
cell b1 = Y
else
b2 = N

then I want to move onto cell a2 and run the same formula e.g

if cell a2 = (few calculations) then
cell b2 = Y
else
b2 = N

but have to run the calculations on about 1000 cells and dont want to type the above out 1000 time (or copy and paste)

Surely there is a loop / step command?

Cheers
Chris
 
for vrow = 1 to 1000
if cells(1,a).value = then

next vrow
and go from there


ck1999
 


ck,

a is used as a variable and is UNDEFINED.
Code:
a = 1
...
if cells (vrow,a).value then
or...
Code:
if cells (vrow,"A").value then


Skip,

[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top