regression vba where the range of X and Y will change

cjcass

Well-known Member
Joined
Oct 27, 2011
Messages
683
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I have the code below which runs a regression for me in Excel 2010. You will see that the DV range (X) is dynamic from AV27 down, so when the quantity of data changes it references it properly - this is fine. The same goes for the IV range (Y) but it is dynamic only in terms of the quantity of rows down - I need it to be dynamic in terms of the number of columns across too - at the moment it is fixed to column 'AZ'. How can the code be amended to reflect this?
Many thanks,

Code:
Application.Run "ATPVBAEN.XLAM!Regress", ActiveSheet.Range("$AV$27:$AV$" & Range("AV" & Rows.Count).End(xlUp).row), ActiveSheet.Range("$AW$27:$AZ$" & Range("AZ" & Rows.Count).End(xlUp).row), False, False, , _ ActiveSheet.Range("$BQ$57"), False, False, False, False, , False
[h=1][/h]
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
please now ignore this request, I have found an alternative solution.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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