Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Simple macros question

I have written a short macros to sample and average data sets and post the
average to a separate cell. I have the macros to repeat 100 times, 100
averages, but don't know how to have it post each average to a progressive
cell. In other words, post the first average to one cell, then index down
for the next average and next,... till there is a list of 100 averages.
After that, I will do more with the data, but need to get by this step first.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Simple macros question

Use a for loop if you know how many times you need to iterate.

For i = 1 to 100
Range("C" & i & "").Select
ActiveCell.FormulaR1C1 = "=AVERAGE("A" & i & ":B" & i & "")"
Next


This assumes A(i) and B(i) hold the numbers you want averaged and the
result is placed in C(i)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Simple macros question

let's assume that the cell, where you

"Eric M." wrote:

I have written a short macros to sample and average data sets and post the
average to a separate cell. I have the macros to repeat 100 times, 100
averages, but don't know how to have it post each average to a progressive
cell. In other words, post the first average to one cell, then index down
for the next average and next,... till there is a list of 100 averages.
After that, I will do more with the data, but need to get by this step first.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Simple macros question

Let's say that the cell where you put the first average is "B1"
You have a macro function getAverage
then try the following

dim avg as double
dim r as integer
dim cB1 as range
set cB1 = range ("B1")
for r = 1 to 100
avg=getAverage
cB1.Offset(r,0).value=avg
next r

"Eric M." wrote:

I have written a short macros to sample and average data sets and post the
average to a separate cell. I have the macros to repeat 100 times, 100
averages, but don't know how to have it post each average to a progressive
cell. In other words, post the first average to one cell, then index down
for the next average and next,... till there is a list of 100 averages.
After that, I will do more with the data, but need to get by this step first.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Simple macros question

Thanks, I'll give it a try.

"Martin Krastev" wrote:

Let's say that the cell where you put the first average is "B1"
You have a macro function getAverage
then try the following

dim avg as double
dim r as integer
dim cB1 as range
set cB1 = range ("B1")
for r = 1 to 100
avg=getAverage
cB1.Offset(r,0).value=avg
next r

"Eric M." wrote:

I have written a short macros to sample and average data sets and post the
average to a separate cell. I have the macros to repeat 100 times, 100
averages, but don't know how to have it post each average to a progressive
cell. In other words, post the first average to one cell, then index down
for the next average and next,... till there is a list of 100 averages.
After that, I will do more with the data, but need to get by this step first.



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
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
simple question about macros mati Excel Programming 3 April 22nd 05 01:43 PM
Learning Macros and ActiveX controls...have a simple question... bizechick Excel Programming 1 November 12th 04 06:45 PM
simple question, hopefully a simple answer! Matt B Excel Programming 5 January 13th 04 08:43 PM


All times are GMT +1. The time now is 08:30 AM.

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

About Us

"It's about Microsoft Excel"