excel_addin/excel_addin/力学曲线.cls

120 lines
4.2 KiB
OpenEdge ABL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Á¦Ñ§ÇúÏß"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$K$11" Or Target.Address = "$H$17" Or Target.Address = "$K$17" Or Target.Address = "$O$17" Then
Dim criticalSpan As Variant
Dim length As Integer
Dim maxSpan As Integer
Dim Epsilon As Double
Dim Alpha As Double
Dim area As Double
Dim lowTemp_t As Double
Dim lowTemp_load As Double
Dim lowTemp_tens As Double
Dim avrTemp_t As Double
Dim avrTemp_load As Double
Dim avrTemp_tens As Double
Dim strongWind_t As Double
Dim strongWind_load As Double
Dim strongWind_tens As Double
Dim ice_t As Double
Dim ice_load As Double
Dim ice_tens As Double
maxSpan = 1000
Epsilon = Range("J5")
Alpha = Range("J6")
area = Range("J9")
lowTemp_t = Range("I20")
lowTemp_load = Range("AD20")
lowTemp_tens = Range("AE20")
avrTemp_t = Range("I21")
avrTemp_load = Range("AD21")
avrTemp_tens = Range("AE21")
strongWind_t = Range("I22")
strongWind_load = Range("AD22")
strongWind_tens = Range("AE22")
ice_t = Range("I23")
ice_load = Range("AD23")
ice_tens = Range("AE23")
criticalSpan = Application.Run("criticalSpanForExcel", maxSpan, Epsilon, Alpha, area, lowTemp_t, lowTemp_load, lowTemp_tens, avrTemp_t, avrTemp_load, avrTemp_tens, strongWind_t, strongWind_load, strongWind_tens, ice_t, ice_load, ice_tens)
length = UBound(criticalSpan)
Dim startCell As Range
Set startCell = Range("W2")
Dim foo As Integer
Range("W2:AH2") = ""
For foo = 1 To length
Cells(startCell.Row, startCell.column - 1 + foo) = criticalSpan(foo)
Next foo
'Ð޸Ĵú±íµµ¾à
expandSpan
End If
Application.EnableEvents = True
End Sub
Private Sub expandSpan()
Dim startSpan As Integer
Dim endSpan As Integer
Dim stepSpan As Integer
startSpan = Range("H17")
endSpan = Range("K17")
stepSpan = Range("O17")
Dim criticalSpan() As Double
Dim foo As Integer
Dim value As Double
Dim criticalSpanN As Integer
criticalSpanN = 0
For foo = 1 To 10
If Cells(Range("W2").Row, Range("W2").column + 2 * (foo - 1)) <> "" Then
criticalSpanN = criticalSpanN + 1
ReDim Preserve criticalSpan(1 To criticalSpanN)
criticalSpan(foo) = Cells(Range("W2").Row, Range("W2").column + 2 * (foo - 1))
End If
Next foo
Dim expandedSpan As Variant
expandedSpan = Application.Run("expandSpan", startSpan, endSpan, stepSpan, criticalSpan)
For foo = 1 To UBound(expandedSpan)
Cells(Range("B69").Row - 1 + foo, Range("B69").column) = expandedSpan(foo)
Next foo
'Ìî³ä¿ØÖÆÌõ¼þ
Range("X69:Z69").Select
Selection.AutoFill Destination:=Range("X69" & ":Z" & 69 + UBound(expandedSpan) - 1), Type:=xlFillDefault
'ÐÞ¸ÄÕÅÁ¦´ú±íµµ¾à
Dim rangeA As String
Dim rangeB As String
For foo = 1 To 9
rangeA = Chr((Asc("D") + 2 * (foo - 1)))
rangeB = Chr((Asc("D") + 2 * foo - 1))
Range(rangeA & "69:" & rangeB & "69").Select
Selection.AutoFill Destination:=Range(rangeA & "69:" & rangeB & (69 + UBound(expandedSpan) - 1)), Type:=xlFillDefault
Next foo
'¼ÜÏßkÖµ
For foo = 1 To 9
rangeA = Chr((Asc("D") + 2 * (foo - 1)))
rangeB = Chr((Asc("D") + 2 * foo - 1))
Range(rangeA & "161:" & rangeB & "161").Select
Selection.AutoFill Destination:=Range(rangeA & "161:" & rangeB & (161 + UBound(expandedSpan) - 1)), Type:=xlFillDefault
Next foo
'¼ÜÏßkÖµ
For foo = 1 To 9
rangeA = Chr((Asc("D") + 2 * (foo - 1)))
rangeB = Chr((Asc("D") + 2 * foo - 1))
Range(rangeA & "209:" & rangeB & "209").Select
Selection.AutoFill Destination:=Range(rangeA & "209:" & rangeB & (209 + UBound(expandedSpan) - 1)), Type:=xlFillDefault
Next foo
End Sub