calculation slope vba
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Calculation of slope in VBA

Calculation of slope in VBA

resolvedResolved · Urgent Priority · Version 2007

replyReply Tue 19 Jul 2011, 14:53Delegate Pierre said...

Pierre has attended:
Excel VBA Intro Intermediate course

Calculation of slope in VBA

Hi,

I tried to calculate a slope in VBA using this:
Sub DeactivationRates()

Dim xL As Range

Dim yL As Range

Dim intSlopeL As Integer

Set xL = Range("B14:B76")

Set yL = Range("C14:C76")

intSlopeL = Application.WorksheetFunction.Slope(yL, xL)

Sheets("Sheet1").Range("B1").Value = intSlopeL

End Sub

I always get the same value of 0.000. Can you help?

Regards,

Pierre

For upcoming training course dates see: Pricing & availability

replyReply Sun 24 Jul 2011, 10:03Trainer Stephen said...

RE: Calculation of slope in VBA

Hi Pierre

Thanks for your question

The first thing that strikes me is that you have declared intslopeL as an integer. As the slope of a line is nearly always a decimal less than 1, this would mean the value will always b e returned to the nearest integer. Try using single as the variable type and see if that helps

Regards

Stephen

Sat 30 Jul 2011: Automatically marked as resolved.

 

Please browse our web site to find out more about
access+vba+courses+london and other Microsoft training courses.

Access tip:

How To Find All Overdue Accounts?

To find overdue accounts create a filter that compares today's date with the Invoice Date in the table. To do this:

1. Open the Query in Design View
2. Select the field for the filter and in the criteria row enter:

<Date()

This filter returns records where the Invoice Date is before today's date.

This filter can be manipulated if, for instance, Invoices are due 15 days after the Invoice Date. For this the filter would be:

<Date()-15

This filter returns records where the Invoice Date is 15 days before today's date.

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard