help me chage macro

ssaifan

Active Member
Joined
Jul 29, 2003
Messages
355
pls help me change this macro....

i have this macro.......
--------------------------------------------------------
Sub STAT2()
Dim xr As Range
Dim yr As Range
Dim dr As Range
Dim last1 As Integer
Dim last2 As Integer
Dim answer
Worksheets("multiple regr.").Range("b16:g20").ClearContents
Sheets("multiple regr.").Select
last1 = 65536 - WorksheetFunction.CountBlank(Worksheets("multiple regr.").Columns("ab")) - 3
last2 = 65536 - WorksheetFunction.CountBlank(Worksheets("multiple regr.").Columns("ac")) - 3
Set yr = Range(Cells(4, 28), Cells(last1, 28))
Set xr = Range(Cells(4, 29), Cells(last2, 29))
answer = Application.WorksheetFunction.LinEst(yr, xr, , True)
Set dr = Sheets("multiple regr.").Range("b16:g20")
dr.Value = answer
End Sub
----------------------------------

now instaad of just column Ac .....i want colums AC to AG ....and data is fropm AC4 to AG .....

how do i change this macro to include this array and not the column which i had specified.....

pls help
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,214,430
Messages
6,119,443
Members
448,898
Latest member
drewmorgan128

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