SOS! Do regression using "ATPVBAEN.XLA!Regress"

oldjack

New Member
Joined
Aug 12, 2009
Messages
1
Hi, everyone, My english name is Jack, I am from Shanghai, China. I am an analyst. Now I meet a VBA problem. I searched online and got many methods but no one can solve the problem. MrExcel is famous and I hope I can get help here.When I use my code to do regression, it always shows "error 1004". (notes: I loaded VBA tool pak, and ticked "ATPVBAEN.XLA" in "reference" under "tools" in VBE)
My code is as follows:
///////starts
Dim i, j As Integer
Cells(2, 2).Select
i = Selection.End(xlDown).Row
j = Selection.End(xlToRight).Column
Application.Run "ATPVBAEN.XLA!Regress", ActiveSheet.Range(Cells(2, 2), Cells(i, 2)), ActiveSheet.Range(Cells(2, 3), Cells(i, j)), False, False, , ActiveSheet.Range("$H$26"), False, False, False, False, , False
//////ends

The 3 solutions I found by google are as follows:
1. If Application.Version <= 11 Then
Application.Run "ATPVBAEN.XLA!Regress" (omit...)
ElseIf Application.Version > 11 Then
Application.Run "ATPVBAEN.XLAM!Regress",(Omit...)
end if
but it doesn't work
2. Microsoft website gave a method: replace (Application.Run "ATPVBAEN.XLA!Regress") with (Application.Run "'Analysis Toolpak - VBA'!Regress) or (Regression), it can't help either; from http://support.microsoft.com/kb/192642

3. add code: Application.Workbooks.Open "C:\Program Files\Microsoft Office\OFFICE11\Library\Analysis\atpvbaen.xla" (it's already my laptop path), but can't work.

Hope you can help me! Thank you very much!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,213,510
Messages
6,114,048
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top