MS Excel; ; MS Excel.
, (. 1).
. 1.
, .
NPV .
.
.
Excel . . ( , ) .
Excel . , Excel ( | ), - (Chart) Chart. Excel Diagram, (, Excel | ).
, Excel . Excel Chart. : Dim oChart As Chart. . Add() Charts: Set oChart = ActiveWorkbook.Charts.Add(, ActiveSheet).
, , , . , . ( ) , SetSourceData(). Range ( ). () , , . .
( " ", . . ). ChartType, 73 . , , : oChart.ChartType = xlLineMarkers.
|
|
. Series , Values ( Range).
, , , . . , , Location. , , : oChart.Location xlLocationAsObject, "1".
Chart.
MS Excel , : Label, TextBox, , ; , NPV, , .
, (. 3), . , .
1. MS Excel. 1 . .
2. . Insert UserForm. . (. 2):
. 2. " "
, .
NPV .
.
.
3. :
Private Sub Workbook_Open()
UserForm1.Show
End Sub
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
Row
Public Row As Integer
Private Sub CommandButton1_Click()
Row = Application.CountA(ActiveSheet.Columns(1)) + 1
1.Cells(Row, 1).Value = TextBox1.Value
1.Cells(Row, 2).Value = TextBox2.Value
1.Cells(2, 3).Value = CDbl(TextBox3.Value)
End Sub
NPV
Private Sub CommandButton2_Click()
Row = Application.CountA(ActiveSheet.Columns(1))
1.Cells(2, 4).FormulaLocal = "=(C2;B2:B" & CStr(Row) & ")"
|
|
If 1.Cells(2, 4).Value < 0 Then Cells(2, 4).Interior.ColorIndex = 6
If 1.Cells(2, 4).Value > 0 Then Cells(2, 4).Interior.ColorIndex = 3
End Sub
Private Sub CommandButton3_Click()
Dim chrt As Chart
Sheets("1").Select
Row = Application.CountA(ActiveSheet.Columns(1))
Sheets("").Select
ActiveWindow.SelectedSheets.Delete
Sheets("1").Select
Set chrt = Application.Charts.Add
chrt.SetSourceData 1.Range("B2:B" & CStr(Row))
chrt.ChartType = xlLineMarkers
ActiveChart.SeriesCollection(1).XValues = 1.Range("A2:A" & CStr(Row))
'
ActiveChart.SeriesCollection(1).Trendlines.Add(Type:=xlLinear, Forward:=3, Backward:=0, DisplayEquation:=True, DisplayRSquared:=False).Select
'
chrt.Location xlLocationAsNewSheet, ""
End Sub
Private Sub CommandButton4_Click()
UserForm1.Hide
End Sub
4. . Excel. . (. 3).
. 3.
5. , . . (. 4).
. 4. ""
6. NPV. (. 5).
. 5. " NPV"
7. . (. 6).
. 6. ""