Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble with passing a range into worksheet function in VBA
------ Hi i am having a lot of trouble with the following piece of
code. ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[50]C,sheet1!R[51]C:R[100]C,2,2)" --- This code looks for the p value within the two groups of a single column. There are 200 columns, and all the columns are arranged so that the first 50 value belongs to one group and the second fifty values belongs to the other. I am trying to write a macro to automate the results of 200 individual ttest for 200 columns from sheet 1 and write them to sheet 2. While this piece of code works most of the time, its not dynamic enough to take into account the situation where the ratio changes for every new 200 ttest it has to perform. For example, the first workbook will have columns with the first 50 that is one group and the second 50 in another, and the second work book will have columns with the first 40 cells that is group one and the next 60 cells in group two. I've tried ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[K]C,sheet1!R[K+1]C:R[100]C,2,2)" by inserting a variable into the column argument and changing k for each new workbook, however, that does not work. Can someone please suggest something? cheers, and thanks ahead of time. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble with passing a range into worksheet function in VBA
ActiveCell.FormulaR1C1 = _
"=TTEST(sheet1!RC:R[" & K & "]C,sheet1!R[" & K & "+1]C:R[100]C,2,2)" -- --- HTH Bob (change the xxxx to gmail if mailing direct) wrote in message ups.com... ------ Hi i am having a lot of trouble with the following piece of code. ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[50]C,sheet1!R[51]C:R[100]C,2,2)" --- This code looks for the p value within the two groups of a single column. There are 200 columns, and all the columns are arranged so that the first 50 value belongs to one group and the second fifty values belongs to the other. I am trying to write a macro to automate the results of 200 individual ttest for 200 columns from sheet 1 and write them to sheet 2. While this piece of code works most of the time, its not dynamic enough to take into account the situation where the ratio changes for every new 200 ttest it has to perform. For example, the first workbook will have columns with the first 50 that is one group and the second 50 in another, and the second work book will have columns with the first 40 cells that is group one and the next 60 cells in group two. I've tried ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[K]C,sheet1!R[K+1]C:R[100]C,2,2)" by inserting a variable into the column argument and changing k for each new workbook, however, that does not work. Can someone please suggest something? cheers, and thanks ahead of time. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble with passing a range into worksheet function in VBA
Hi, thanks for the suggestion but how should i intialized K. Do i declare it as a long? Dim K as Long? Setting K to a specific number does not seem to work cheers, and thank you once again, and whoever may answer On Jan 25, 4:38 pm, "Bob Phillips" wrote: ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[" & K & "]C,sheet1!R[" & K & "+1]C:R[100]C,2,2)" -- --- HTH Bob (change the xxxx to gmail if mailing direct) wrote in oglegroups.com... ------ Hi i am having a lot of trouble with the following piece of code. ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[50]C,sheet1!R[51]C:R[100]C,2,2)" --- This code looks for the p value within the two groups of a single column. There are 200 columns, and all the columns are arranged so that the first 50 value belongs to one group and the second fifty values belongs to the other. I am trying to write a macro to automate the results of 200 individual ttest for 200 columns from sheet 1 and write them to sheet 2. While this piece of code works most of the time, its not dynamic enough to take into account the situation where the ratio changes for every new 200 ttest it has to perform. For example, the first workbook will have columns with the first 50 that is one group and the second 50 in another, and the second work book will have columns with the first 40 cells that is group one and the next 60 cells in group two. I've tried ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[K]C,sheet1!R[K+1]C:R[100]C,2,2)" by inserting a variable into the column argument and changing k for each new workbook, however, that does not work. Can someone please suggest something? cheers, and thanks ahead of time.- Hide quoted text -- Show quoted text - |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble with passing a range into worksheet function in VBA
Yes it should be long.What does the second part mean?
-- --- HTH Bob (change the xxxx to gmail if mailing direct) wrote in message oups.com... Hi, thanks for the suggestion but how should i intialized K. Do i declare it as a long? Dim K as Long? Setting K to a specific number does not seem to work cheers, and thank you once again, and whoever may answer On Jan 25, 4:38 pm, "Bob Phillips" wrote: ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[" & K & "]C,sheet1!R[" & K & "+1]C:R[100]C,2,2)" -- --- HTH Bob (change the xxxx to gmail if mailing direct) wrote in oglegroups.com... ------ Hi i am having a lot of trouble with the following piece of code. ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[50]C,sheet1!R[51]C:R[100]C,2,2)" --- This code looks for the p value within the two groups of a single column. There are 200 columns, and all the columns are arranged so that the first 50 value belongs to one group and the second fifty values belongs to the other. I am trying to write a macro to automate the results of 200 individual ttest for 200 columns from sheet 1 and write them to sheet 2. While this piece of code works most of the time, its not dynamic enough to take into account the situation where the ratio changes for every new 200 ttest it has to perform. For example, the first workbook will have columns with the first 50 that is one group and the second 50 in another, and the second work book will have columns with the first 40 cells that is group one and the next 60 cells in group two. I've tried ActiveCell.FormulaR1C1 = _ "=TTEST(sheet1!RC:R[K]C,sheet1!R[K+1]C:R[100]C,2,2)" by inserting a variable into the column argument and changing k for each new workbook, however, that does not work. Can someone please suggest something? cheers, and thanks ahead of time.- Hide quoted text -- Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing a range to a function | Excel Programming | |||
Passing a range to a function | Excel Programming | |||
passing a range from another worksheet | Excel Programming | |||
Passing a range into a VBA function | Excel Programming | |||
Passing range as an argument in a function | Excel Programming |