Vous êtes sur la page 1sur 4

Sub Check()

Dim opt As Boolean


Dim iComb, nComb As Integer
Dim iRow, nRow As Integer
Dim iSection, nSection As Integer

Dim RefIndex As String


Dim ElemName As Integer
Dim ColName As String
Dim Level As String
Dim Loadcase As String

Dim l As Double

Dim Ntop As Double


Dim Vztop As Double
Dim Vytop As Double
Dim Ttop As Double
Dim Myytop As Double
Dim Mzztop As Double

Dim Nbot As Double


Dim Vzbotp As Double
Dim Vybot As Double
Dim Tbot As Double
Dim Myybot As Double
Dim Mzzbot As Double

Application.Calculation = xlCalculationManual

With ThisWorkbook.Worksheets("Forces")
nComb = .Cells(9, 26).Value
nRow = .Cells(11, 26).Value
End With

For iRow = ThisWorkbook.Worksheets("Forces").Cells(10, 26).Value To nRow

RefIndex = 0
ElemName = 0
ColName = 0
Level = 0
Loadcase = 0
l=0

Ntop = 0
Vztop = 0
Vytop = 0
Ttop = 0
Myytop = 0
Mzztop = 0

Nbot = 0
Vzbotp = 0
Vybot = 0
Tbot = 0
Myybot = 0
Mzzbot = 0

'The following paragraph reads in the forces of the analysis program,


'which are copied into worksheet "Forces"

With ThisWorkbook.Worksheets("Forces")

RefIndex = .Cells(iRow + 3, 1)
ElemName = .Cells(iRow + 3, 2)
ColName = .Cells(iRow + 3, 3)
Level = .Cells(iRow + 3, 4)
Loadcase = .Cells(iRow + 3, 7)

l = .Cells(iRow + 3, 5)

Ntop = -1 * .Cells(iRow + 3, 9)
Vztop = .Cells(iRow + 3, 10)
Vytop = .Cells(iRow + 3, 11)
Ttop = .Cells(iRow + 3, 12)
Myytop = .Cells(iRow + 3, 13)
Mzztop = .Cells(iRow + 3, 14)

Nbot = -1 * .Cells(iRow + 3, 16)


Vzbotp = .Cells(iRow + 3, 17)
Vybot = .Cells(iRow + 3, 18)
Tbot = .Cells(iRow + 3, 19)
Myybot = .Cells(iRow + 3, 20)
Mzzbot = .Cells(iRow + 3, 21)
End With

'The following paragraph checks the sections against the forces starting from the smallest the first section
'in the list. In case the section fails the next list is checked.

With ThisWorkbook.Worksheets("Section Dial")

nSection = .Cells(209, 27).Value

End With

For iSection = 195 To 198


'check
With ThisWorkbook.Worksheets("CALCULATIONS")

.Cells(8, 5) = RefIndex
.Cells(8, 6) = ElemName
.Cells(8, 7) = ColName
.Cells(8, 8) = Level
.Cells(8, 9) = Loadcase

.Cells(22, 7) = iSection

.Cells(14, 4) = l

.Cells(14, 5) = Ntop
.Cells(14, 6) = Vztop
.Cells(14, 7) = Vytop
.Cells(14, 8) = Ttop
.Cells(14, 9) = Myytop
.Cells(14, 10) = Mzztop

.Cells(15, 5) = Nbot
.Cells(15, 6) = Vzbotp
.Cells(15, 7) = Vybot
.Cells(15, 8) = Tbot
.Cells(15, 9) = Myybot
.Cells(15, 10) = Mzzbot

Application.Calculate

If .Cells(72, 17) <= ThisWorkbook.Worksheets("Forces").Cells(14, 26) Then


Exit For
End If
End With
Next iSection

'The following paragraph the output of the calculations are copied into the worksheet "Output"

With ThisWorkbook.Worksheets("Output")
If ThisWorkbook.Worksheets("CALCULATIONS").Cells(72, 17) <=
ThisWorkbook.Worksheets("Forces").Cells(14, 26) Then
.Cells(iRow + 4, 1) = ThisWorkbook.Worksheets("CALCULATIONS").Cells(8, 5)
.Cells(iRow + 4, 2) = ThisWorkbook.Worksheets("CALCULATIONS").Cells(8, 6)
.Cells(iRow + 4, 3) = ThisWorkbook.Worksheets("REPORT").Cells(19, 4)
.Cells(iRow + 4, 4) = ThisWorkbook.Worksheets("CALCULATIONS").Cells(72, 17)
Else
.Cells(iRow + 4, 1) = ThisWorkbook.Worksheets("CALCULATIONS").Cells(8, 5)
.Cells(iRow + 4, 2) = ThisWorkbook.Worksheets("CALCULATIONS").Cells(8, 6)
.Cells(iRow + 4, 3) = "MANUAL CHECK"
.Cells(iRow + 4, 4) = ThisWorkbook.Worksheets("CALCULATIONS").Cells(72, 17)
End If
End With

Next iRow

Application.Calculation = xlCalculationManual

End Sub

Vous aimerez peut-être aussi