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
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