×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Calculate a possible value of year 2018 (trend/slope value?)

## Calculate a possible value of year 2018 (trend/slope value?)

(OP)
I just have post the question in VBA but really i need in vb6, sorry.

Have a label:

L2012.caption=23
L2013.caption=4
L2014.caption=23
L2015.caption=4
L2016.caption=11
L2017.caption=0

Is possible to estimate the value for the year 2018?

note:
The various labels contain the values of the work done in my office from the old years.
How to?
Grazie

### RE: Calculate a possible value of year 2018 (trend/slope value?)

And, from https://www.varsitytutors.com/hotmath/hotmath_help..., something like:

#### CODE

Option Explicit
Option Base 1

Private Sub Command1_Click()
Dim fred(6) As Double
fred(1) = 23
fred(2) = 4
fred(3) = 23
fred(4) = 4
fred(5) = 11
fred(6) = 0

MsgBox TrendNextPoint(fred)

End Sub

Public Function TrendNextPoint(fred() As Double) As Double
TrendNextPoint = Trend(fred, UBound(fred) + 1)
End Function

Public Function Trend(arrSample() As Double, newpoint) As Double
Dim lp As Long
Dim meanX As Double
Dim meanY As Double
Dim xy As Double
Dim xx As Double
Dim m As Double
Dim b As Double

For lp = 1 To UBound(arrSample)
meanX = meanX + lp
meanY = meanY + arrSample(lp)
Next
meanX = meanX / (lp - 1)
meanY = meanY / (lp - 1)

For lp = 1 To UBound(arrSample)
xy = xy + (lp - meanX) * (arrSample(lp) - meanX)
xx = xx + (lp - meanX) * (lp - meanX)
Next
m = xy / xx
b = meanY - m * meanX

Trend = newpoint * m + b

End Function

### RE: Calculate a possible value of year 2018 (trend/slope value?)

(OP)
Strongm, i dont know the really name

TKS!
The code work a like a charm!
tks for patience.

but...

i need to rapresent the trend result with a wingding 3 font in a subitems cell of listview similar:

good trend green fonts color, arrow up
no good trend red font color, arrow down

how to?

### RE: Calculate a possible value of year 2018 (trend/slope value?)

You should probably post that as a seperate question. However, the short answer is that the VB6 ListView control has a global setting for the font, so you cannot use a different font for subitems (although you can set colour separately). Nor does the Vb6 ListView support Unicode, so you can't even use Unicode arrows as an alternative.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!