LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to print LinEst result to a spreadsheet using VBA

I don't understand. You can use VBA code to populate the cells with a formula.
You could even convert the results of the formula to values.

But if you want:

Option Explicit
Sub Testme()

Dim Xs As Variant
Dim Ys As Variant
Dim res As Variant

Dim HowManyRows As Long
Dim HowManyCols As Long
Dim DestCell As Range

With ActiveSheet
'test data and the topleftcell of the result range.
Xs = .Range("b1:b10").Value
Ys = .Range("a1:a10").Value
Set DestCell = .Range("f9")
End With

res = Application.LinEst(Xs, Ys, , True)

HowManyRows = UBound(res, 1) - LBound(res, 1) + 1
HowManyCols = UBound(res, 2) - LBound(res, 2) + 1

DestCell.Resize(HowManyRows, HowManyCols).Value = res

End Sub


Fei wrote:

Thanks Dave.

VBA code is preferred, as I run regressions for different worksheets...


--

Dave Peterson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
My excel spreadsheet won't print or print preview all the pages? whirlybird Excel Worksheet Functions 2 April 4th 23 10:50 AM
how to use linest to get the result as ARRAY? frank Excel Worksheet Functions 1 May 7th 07 06:49 AM
r2 result in LINEST Excel 97 v Excel 2003 Philip J Smith Excel Discussion (Misc queries) 2 January 3rd 07 04:31 PM
How do I extract a single value from the linest array result? hil Excel Worksheet Functions 3 July 12th 06 12:37 PM
One spreadsheet cell won't print but shows up in print preview? Sally Excel Discussion (Misc queries) 1 May 26th 05 07:06 PM


All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"