LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Refer to Column with a variable

Hi. I would like very much to figure out how to refer to a column using a
variable. The A1 notation does not seem to be conducive to this, and I can't
figure out how to work the syntax.

Basically, I'm creating a macro that will create a data sheet for me. I
enter the number of subjects I have and it creates that many rows. Then I
enter how many trials and it creates that many columns. So for each row, I
want to insert a formula that averages the values for each subject.

For instance, if my data starts in column E and I have 5 trials, I want
column J to be the average of E - I. But depending on how many trials I
have, this formula will differ. Sometimes it will be 6 trials, so column K
will be the average of E - J, and so on.

I have loops that iterate through the columns and rows to set up my
headings, etc. But I can't figure out how to insert the formula that will
calculate a range using a variable name (which is used to iterate through the
loops, hold the current row number, etc). Could someone please provide some
sample code that shows me how to calculate an average using a range selected
by variable names and not A1 notation? I would very much appreciate that.
Thanks in advance.
 
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
Refer to Public Variable from Another Workbook Mike H. Excel Programming 3 December 11th 07 08:33 PM
How to refer variable while assigning string value? [email protected] Excel Programming 1 August 7th 06 08:06 AM
variable to refer to "this worksheet"? confused Excel Worksheet Functions 1 June 16th 05 11:51 PM
Using a variable to refer a cell jeam Excel Programming 1 February 13th 05 03:25 PM
How to refer a Variable across Workbooks ? Prabhu Dev Excel Programming 1 November 27th 03 05:22 AM


All times are GMT +1. The time now is 09:32 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"