Cell Contents to Define Regression Ranges in Macro

scf2002

New Member
Joined
Apr 22, 2009
Messages
1
I am trying to write a macro that will run a regression analysis for me using ranges that I define in cells A1 (for the Y variable) and B1 (for the X variables). For example, a sample size of 250 will produce the following cell contents: A1 contains "$B$13:$B$263" and B1 contains "$C$13:$I$263". Changing the sample size for my regression will change the contents of cells A1 & B1.

In the VBA code below, the Y & X ranges for my regression are fixed, but I would like them to be variable and take on whatever "value" is in cells A1 & B1. I have spent hours searching message boards and sought advice from co-workers, to no avail. Please HELP!

Application.Run "Regress",
ActiveSheet.Range("$B$13:$B$263"),
ActiveSheet.Range("$C$13:$I$263"),
False, False, , _"macro regr", False, False, False, False, , False
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,215,635
Messages
6,125,945
Members
449,275
Latest member
jacob_mcbride

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