VBA Problem going from Excel 2003 to Excel 97

  • Thread starter Thread starter RyanVM
  • Start date Start date
R

RyanVM

OK, this one has me extremely perplexed. I've got this line in a macr
I'm working on
Code
-------------------
Slope = Application.WorksheetFunction.Index(Application.WorksheetFunction.LinEst(Range("C" & MinRow & ":C" & MaxRow), Range("B" & MinRow & ":B" & MaxRow)), 1, 1
-------------------
Where Slope is a Double and MinRow & MaxRow are both Integers (assigne
values prior to this line).

This code worked perfectly in Excel 2003 on my home computer las
night, but when I took it back to work today and tried to run the macr
in Excel 97, I get the following error
Code
 
No reason it shouldn't but as suggested yesterday, why not use the Slope
Worksheetfunction directly.

--
Regards,
Tom Ogilvy

RyanVM > said:
OK, this one has me extremely perplexed. I've got this line in a macro
I'm working on:
Code:
Application.WorksheetFunction.Index(Application.WorksheetFunction.LinEst(Ran
ge("C" & MinRow & ":C" & MaxRow), Range("B" & MinRow & ":B" & MaxRow)), 1,
1)
 
Because it's doing a curve fit of 1000 data points.

I found the problem. Once again, it was a head slapper (now I'
remember why I went into engineering instead of Computer Science :p).
managed to delete a line which assigned a value to one of the mai
variables used in the macro.

Thanks again for the help. This is the first Excel macro I've eve
written, so it's been a bit bumpy
 
Because it's doing a curve fit of 1000 data points.

I must be missing something. Slope takes the same arguments as LINEST.
 
Tom said:
*I must be missing something. Slope takes the same arguments a
LINEST.
it's probably I that's missing something.

In fact, now that I look at the documentation for the SLOPE() function
it would appear that such is the case! I'm going to switch the macr
over to the SLOPE() function since I'd imagine it's considerably faste
since it's not doing all of the other LINEST() calculations
 
Just letting you know that switching it over proved successful, an
speed optimizations are always appreciated
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top