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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to VBA Analysis Toolpak ANOVA? 1

Status
Not open for further replies.

migv1

Technical User
Apr 23, 2004
39
0
0
US
Greetings;

I searched the forums and didn't find anything, so I hope this hasn't been asked before:

How do you write code to automate a single factor ANOVA using the Tools > Data Analysis function? I have enabled both the Analysis ToolPak and Analysis ToolPak - VBA add-ins, but when I try to record a macro using this function, nothing appears.

I plan to attach the code to a command button in a template that will be used to randomize subjects into groups and test whether significant differences exist between the groups based on a single variable.

Thanks in advance for any and all help.
 




Hi,

My macro recorder...
[coe]
Application.Run "ATPVBAEN.XLA!Anova1", ActiveSheet.Range("$A$2:$A$10"), _
ActiveSheet.Range("$C$2:$C$10"), "R", False, 0.05
[/code]

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Thanks, Skip!

After a little modification to account for the data and target cells, arrangement of data in columns, and existence of a header row, it works like a charm.

I wonder why my macro recorder didn't record anything...
 



Did you have the recorder on from the beginning (openeing the Tools ment, thru to the point where the sheet is populated?

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Hi, Skip:

Yes, I had it on the whole time, starting from selecting the data range, through opening Tools, selecting Data Analysis, etc. At the end, I park the selection at cell A1 out of habit, and that was the only thing that was captured by the macro recorder.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top