#1   Report Post  
Posted to microsoft.public.excel.misc
Jackie
 
Posts: n/a
Default vba loop

Hi all, I need your expertise ...
here's what I am doing:

Dim i as Integer
For i = 1 to 10
ActiveCell.Formula = "sumif(e2:e30000, "i",j2:j30000)"
ActiveCell.Offset(0,1).select
Next i

I want this to run through 10 times and also use the value of "i" in the
formula. ie: its first time through it looks for 1 then 2 then 3 ... I
can't seem to get it to recognize i as a variable instead it just looks for i
in the columns.

I appreciate your help!

--
Jackie
  #2   Report Post  
Posted to microsoft.public.excel.misc
L. Howard Kittle
 
Posts: n/a
Default vba loop

Hi Jackie,
Quick guess, did not test.. drop the "i" to i only???
In quotes I do think it is looking for text.

HTH
regards,
Howard

"Jackie" wrote in message
...
Hi all, I need your expertise ...
here's what I am doing:

Dim i as Integer
For i = 1 to 10
ActiveCell.Formula = "sumif(e2:e30000, "i",j2:j30000)"
ActiveCell.Offset(0,1).select
Next i

I want this to run through 10 times and also use the value of "i" in the
formula. ie: its first time through it looks for 1 then 2 then 3 ... I
can't seem to get it to recognize i as a variable instead it just looks
for i
in the columns.

I appreciate your help!

--
Jackie



  #3   Report Post  
Posted to microsoft.public.excel.misc
bpeltzer
 
Posts: n/a
Default vba loop

You need to create a string that would like just like the formula as if you
typed it:
ActiveCell.Formula = "=sumif(e2:e30000, " & i & ",j2:j30000)"
--Bruce

"Jackie" wrote:

Hi all, I need your expertise ...
here's what I am doing:

Dim i as Integer
For i = 1 to 10
ActiveCell.Formula = "sumif(e2:e30000, "i",j2:j30000)"
ActiveCell.Offset(0,1).select
Next i

I want this to run through 10 times and also use the value of "i" in the
formula. ie: its first time through it looks for 1 then 2 then 3 ... I
can't seem to get it to recognize i as a variable instead it just looks for i
in the columns.

I appreciate your help!

--
Jackie

  #4   Report Post  
Posted to microsoft.public.excel.misc
Jackie
 
Posts: n/a
Default vba loop

it repeats the formula sumif(e2:e30000,i,j2:j30000) ten times ..?.. instead
of adding all the 1's (and putting the total in 1 cell) , then all the 2's
(putting the total in the second cell, all the 3's etc....
--
Jackie


"L. Howard Kittle" wrote:

Hi Jackie,
Quick guess, did not test.. drop the "i" to i only???
In quotes I do think it is looking for text.

HTH
regards,
Howard

"Jackie" wrote in message
...
Hi all, I need your expertise ...
here's what I am doing:

Dim i as Integer
For i = 1 to 10
ActiveCell.Formula = "sumif(e2:e30000, "i",j2:j30000)"
ActiveCell.Offset(0,1).select
Next i

I want this to run through 10 times and also use the value of "i" in the
formula. ie: its first time through it looks for 1 then 2 then 3 ... I
can't seem to get it to recognize i as a variable instead it just looks
for i
in the columns.

I appreciate your help!

--
Jackie




  #5   Report Post  
Posted to microsoft.public.excel.misc
Jackie
 
Posts: n/a
Default vba loop

this worked perfect! thank you so much!
--
Jackie


"bpeltzer" wrote:

You need to create a string that would like just like the formula as if you
typed it:
ActiveCell.Formula = "=sumif(e2:e30000, " & i & ",j2:j30000)"
--Bruce

"Jackie" wrote:

Hi all, I need your expertise ...
here's what I am doing:

Dim i as Integer
For i = 1 to 10
ActiveCell.Formula = "sumif(e2:e30000, "i",j2:j30000)"
ActiveCell.Offset(0,1).select
Next i

I want this to run through 10 times and also use the value of "i" in the
formula. ie: its first time through it looks for 1 then 2 then 3 ... I
can't seem to get it to recognize i as a variable instead it just looks for i
in the columns.

I appreciate your help!

--
Jackie

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop gone crazy Dave Peterson Excel Discussion (Misc queries) 4 December 16th 05 03:38 PM
Do Loop Noemi Excel Discussion (Misc queries) 0 December 8th 05 10:43 PM
Help with Do...Loop Noemi Excel Discussion (Misc queries) 1 December 7th 05 12:59 AM
hysteresis loop olivekim Charts and Charting in Excel 1 October 28th 05 04:22 AM
loop trough e-mail address list to send task lists with outlook Paul. Excel Discussion (Misc queries) 2 April 14th 05 11:48 AM


All times are GMT +1. The time now is 05:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"