formula vba vigas

Upload: jose-rivera-ramirez

Post on 07-Jul-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/18/2019 Formula VBA vigas

    1/41

    FORMULARIOS

    Private Sub CommandButTon1_Click()

    frmDisclaimer.Hide

    End Sub 

    Private Sub UserForm_Click()

    End Sub 

    Private Sub CommandButTon1_Click()

  • 8/18/2019 Formula VBA vigas

    2/41

    frminstr.Hide

    End Sub 

    Private Sub Label1_Click()

    End Sub 

    Private Sub btnAdd_Click()

    LdChange = 0

     NoloadsStat = NoloadsStat + 1

    'Span Number

    LoadinStat(1, NoloadsStat) = frmLoadin.cmbSpanNo.ListIndex

    If  frmLoadin.cmbSpanNo.ListIndex = 0 Then 

     NoloadsStat = NoloadsStat - 1 If  frmLoadin.ComLoadType.ListIndex = 7 Then 

    MsgBox "Select Support No. For  Settlement", 16, "Error"

    Else 

    MsgBox "Select Span No. For  Load", 16, "Error"

    End If  

    Exit Sub 

    End If  

    'load type

    LoadinStat(2, NoloadsStat) = Ldtype

    'Load intensity

    If  frmLoadin.edtIntensity.Visible = False Then 

     NoloadsStat = NoloadsStat - 1

    Exit Sub 

    End If  

    If  frmLoadin.edtIntensity.Value = "" Then 

  • 8/18/2019 Formula VBA vigas

    3/41

      NoloadsStat = NoloadsStat - 1

    Exit Sub 

    End If  

    LoadinStat(3, NoloadsStat) = frmLoadin.edtIntensity.Value

    LoadinStat(4, NoloadsStat) = 0 'Start of load 

    LoadinStat(5, NoloadsStat) = 0 'Length of load 

    If  Ldtype = 1 Then If  frmLoadin.edtStrtDist.Value = "" Then 

     NoloadsStat = NoloadsStat - 1

    Exit Sub 

    End If  

    If  frmLoadin.edtStrtDist.Value > L(LoadinStat(1, NoloadsStat)) Then 

    MsgBox "Distance 'a' is greater than the length of Span " & LoadinStat(1, NoloadsStat) & ""

     NoloadsStat = NoloadsStat - 1

    Exit Sub 

    End If  

    LoadinStat(4, NoloadsStat) = frmLoadin.edtStrtDist.Value 'Start of load 

    End If  

    If  Ldtype = 3 Then If  frmLoadin.edtStrtDist.Value = "" Then 

     NoloadsStat = NoloadsStat - 1

    Exit Sub 

    End If  

    If  frmLoadin.edtStrtDist.Value > L(LoadinStat(1, NoloadsStat)) Then 

    MsgBox "Distance 'a' is greater than the length of Span " & LoadinStat(1, NoloadsStat) & ""

     NoloadsStat = NoloadsStat - 1

    Exit Sub 

    End If  

    LoadinStat(4, NoloadsStat) = frmLoadin.edtStrtDist.Value

    If  frmLoadin.edtLenUdl.Value = "" Then 

     NoloadsStat = NoloadsStat - 1

    Exit Sub 

    End If  

    If  LoadinStat(4, NoloadsStat) + frmLoadin.edtLenUdl.Value > L(LoadinStat(1, NoloadsStat)) Then 

    MsgBox "Distance 'a+b' is greater than the length of Span " & LoadinStat(1, NoloadsStat) & ""

     NoloadsStat = NoloadsStat - 1

    Exit Sub 

    End If  

    LoadinStat(5, NoloadsStat) = frmLoadin.edtLenUdl.Value

    End If  

    If  frmLoadin.ComLoadType.ListIndex = 7 Then If  frmLoadin.cmbSpanNo.ListIndex = 1 Then 

    LoadinStat(3, NoloadsStat) = -frmLoadin.edtIntensity.Value

    Call PrintLoads

    End If  

    If  frmLoadin.cmbSpanNo.ListIndex > 1 And frmLoadin.cmbSpanNo.ListIndex < NoSpn + 1 Then 

    LoadinStat(1, NoloadsStat) = LoadinStat(1, NoloadsStat) - 1

    Call PrintLoads

    LoadinStat(1, NoloadsStat + 1) = LoadinStat(1, NoloadsStat) + 1

     NoloadsStat = NoloadsStat + 1

    LoadinStat(2, NoloadsStat) = Ldtype

  • 8/18/2019 Formula VBA vigas

    4/41

      LoadinStat(3, NoloadsStat) = -frmLoadin.edtIntensity.Value

    Call PrintLoads

    End If  

    If  frmLoadin.cmbSpanNo.ListIndex = NoSpn + 1 Then 

    LoadinStat(1, NoloadsStat) = LoadinStat(1, NoloadsStat) - 1

    Call PrintLoads

    End If  

    Else 

    Call PrintLoadsEnd If  

    End Sub 

    Private Sub PrintLoads()

    Worksheets("Line Beam").Cells(LineC, 2).NumberFormat = "0"

    Worksheets("Line Beam").Cells(LineC, 2) = LoadinStat(1, NoloadsStat)

    Worksheets("Line Beam").Cells(LineC, 3).NumberFormat = "General"

    Worksheets("Line Beam").Cells(LineC, 3).HorizontalAlignment = xlLeft

    Select Case LoadinStat(2, NoloadsStat)

    Case 1

    LoadDes = "Point Load"

    Case 2LoadDes = "Full UDL"

    Case 3

    LoadDes = "Part UDL"

    Case 4

    LoadDes = "IncreAsing Triangular"

    Case 5

    LoadDes = "DecreAsing Triangular"

    Case 6

    LoadDes = "Triangular Load"

    Case 7

    LoadDes = "Settlement"

    End Select 

    Worksheets("Line Beam").Cells(LineC, 3) = LoadDes

    Worksheets("Line Beam").Cells(LineC, 5).NumberFormat = "0.000"

    If  Abs(LoadinStat(3, NoloadsStat)) > 999 Then Worksheets("Line Beam").Cells(LineC, 5).NumberFormat = "0.00"

    If  Abs(LoadinStat(3, NoloadsStat)) > 9999 Then Worksheets("Line Beam").Cells(LineC, 5).NumberFormat = "0.0"

    If  Abs(LoadinStat(3, NoloadsStat)) > 99999 Then Worksheets("Line Beam").Cells(LineC, 5).NumberFormat = "0"

    Worksheets("Line Beam").Cells(LineC, 5) = LoadinStat(3, NoloadsStat)

    If  LoadinStat(2, NoloadsStat) = 1 Or LoadinStat(2, NoloadsStat) = 3 Then 

    Worksheets("Line Beam").Cells(LineC, 6).NumberFormat = "0.000"

    If  Abs(LoadinStat(4, NoloadsStat)) > 999 Then Worksheets("Line Beam").Cells(LineC, 6).NumberFormat = "0.00"

    If  Abs(LoadinStat(4, NoloadsStat)) > 9999 Then Worksheets("Line Beam").Cells(LineC, 6).NumberFormat = "0.0"

    If  Abs(LoadinStat(4, NoloadsStat)) > 99999 Then Worksheets("Line Beam").Cells(LineC, 6).NumberFormat = "0"Worksheets("Line Beam").Cells(LineC, 6) = LoadinStat(4, NoloadsStat)

    End If  

    If  LoadinStat(2, NoloadsStat) = 3 Then 

    Worksheets("Line Beam").Cells(LineC, 7).NumberFormat = "0.000"

    If  Abs(LoadinStat(5, NoloadsStat)) > 999 Then Worksheets("Line Beam").Cells(LineC, 7).NumberFormat = "0.00"

    If  Abs(LoadinStat(5, NoloadsStat)) > 9999 Then Worksheets("Line Beam").Cells(LineC, 7).NumberFormat = "0.0"

    If  Abs(LoadinStat(5, NoloadsStat)) > 99999 Then Worksheets("Line Beam").Cells(LineC, 7).NumberFormat = "0"

    Worksheets("Line Beam").Cells(LineC, 7) = LoadinStat(5, NoloadsStat)

    End If  

    LineC = LineC + 1

  • 8/18/2019 Formula VBA vigas

    5/41

    End Sub 

    Private Sub cmbSpanNo_Change()

    LdChange = 1

    End Sub 

    Private Sub cmdCancel_Click()

    Dim St As Integer , Fin As Integer  

    If  NoloadsStat = NoloadsOld Then 

    frmLoadin.Hide

    Exit Sub 

    End If  

    St = NoloadsStat

    Fin = NoloadsOld + 1

    For  I = St To Fin Step -1

    For  J = 1 To 5LoadinStat(J, I) = 0

    Worksheets("Line Beam").Cells(LineC, 1 + J) = ""

     Next J

     NoloadsStat = NoloadsStat - 1

    LineC = LineC - 1

     Next I

    Worksheets("Line Beam").Range("B" & LineC & " : G" & LineC & "") = ""

    frmLoadin.Hide

    End Sub 

    Private Sub cmdClear_Click()

    For  J = 1 To NoloadsStat

    For  I = 1 To 5

    Worksheets("Line Beam").Cells(LineC - 1, I + 1) = ""

    LoadinStat(I, J) = 0

     Next I

    Worksheets("Line Beam").Cells(LineC - 1, 7) = ""

    LineC = LineC - 1

     Next J

     NoloadsStat = 0

    If  NoSpn = 1 Then 

    frmLoadin.cmbSpanNo.ListIndex = 1Else 

    frmLoadin.cmbSpanNo.ListIndex = 0

    End If  

    frmLoadin.ComLoadType.ListIndex = 0

    frmLoadin.edtIntensity.Value = ""

    frmLoadin.edtLenUdl.Value = ""

    frmLoadin.edtStrtDist.Value = ""

    frmLoadin.edtIntensity.Visible = False 

    frmLoadin.edtLenUdl.Visible = False 

    frmLoadin.edtStrtDist.Visible = False 

  • 8/18/2019 Formula VBA vigas

    6/41

    frmLoadin.lblStrt.Visible = False 

    frmLoadin.lblLen.Visible = False 

    frmLoadin.lblLoad.Visible = False 

    End Sub 

    Private Sub cmdUndo_Click()

    If  NoloadsStat = 0 Then Exit Sub 

    For  I = 1 To 5Worksheets("Line Beam").Cells(LineC - 1, I + 1) = ""

    LoadinStat(I, NoloadsStat) = 0

     Next I

    Worksheets("Line Beam").Cells(LineC - 1, 7) = ""

     NoloadsStat = NoloadsStat - 1

    LineC = LineC - 1

    End Sub 

    Private Sub ComLoadType_Click()

    LdChange = 1

    With frmLoadinSelect Case .ComLoadType.ListIndex

    Case 1 'Point Load 

    .cmbSpanNo.Visible = True 

    .Label1.Caption = "Span No"

    .Label1.Visible = True 

    .edtIntensity.Visible = True 

    .edtStrtDist.Visible = True 

    .edtLenUdl.Visible = False 

    .lblStrt.Visible = True 

    .lblLen.Visible = False 

    .lblLoad.Visible = True 

    .lblLoad.Caption = "Intensity W (kN)"

    Call FillSpanCombo

    Case 2 'Full UDL 

    .cmbSpanNo.Visible = True 

    .Label1.Caption = "Span No"

    .Label1.Visible = True 

    .edtIntensity.Visible = True 

    .edtStrtDist.Visible = False 

    .edtLenUdl.Visible = False 

    .lblStrt.Visible = False 

    .lblLen.Visible = False 

    .lblLoad.Visible = True 

    .lblLoad.Caption = "Intensity w (kN/m)"

    Call FillSpanCombo

    Case 3 'Part UDL 

    .cmbSpanNo.Visible = True 

    .Label1.Caption = "Span No"

    .Label1.Visible = True 

    .edtIntensity.Visible = True 

  • 8/18/2019 Formula VBA vigas

    7/41

      .edtStrtDist.Visible = True 

    .edtLenUdl.Visible = True 

    .lblStrt.Visible = True 

    .lblLen.Visible = True 

    .lblLoad.Visible = True 

    .lblLoad.Caption = "Intensity w (kN/m)"

    Call FillSpanCombo

    Case 4 'IncreAsing Load .cmbSpanNo.Visible = True 

    .Label1.Caption = "Span No"

    .Label1.Visible = True 

    .edtIntensity.Visible = True 

    .edtStrtDist.Visible = False 

    .edtLenUdl.Visible = False 

    .lblStrt.Visible = False 

    .lblLen.Visible = False 

    .lblLoad.Visible = True 

    .lblLoad.Caption = "Intensity w (kN/m)"

    Call FillSpanCombo

    Case 5 'DecreAsing Load 

    .cmbSpanNo.Visible = True 

    .Label1.Caption = "Span No"

    .Label1.Visible = True 

    .edtIntensity.Visible = True 

    .edtStrtDist.Visible = False 

    .edtLenUdl.Visible = False 

    .lblStrt.Visible = False 

    .lblLen.Visible = False 

    .lblLoad.Visible = True 

    .lblLoad.Caption = "Intensity w (kN/m)"

    Call FillSpanCombo

    Case 6 'Triangular Load

    .cmbSpanNo.Visible = True 

    .Label1.Caption = "Span No"

    .Label1.Visible = True 

    .edtIntensity.Visible = True 

    .edtStrtDist.Visible = False 

    .edtLenUdl.Visible = False 

    .lblStrt.Visible = False 

    .lblLen.Visible = False 

    .lblLoad.Visible = True 

    .lblLoad.Caption = "Intensity w (kN/m)"

    Call FillSpanCombo

    Case 7 'Settlement 

    .cmbSpanNo.Visible = True 

    .Label1.Caption = "Support No"

    .Label1.Visible = True 

    .edtIntensity.Visible = True 

    .edtStrtDist.Visible = False 

    .edtLenUdl.Visible = False 

  • 8/18/2019 Formula VBA vigas

    8/41

      .lblStrt.Visible = False 

    .lblLen.Visible = False 

    .lblLoad.Visible = True 

    .lblLoad.Caption = "delta (mm)"

    Call FillSupportCombo

    End Select 

    End With 

    Ldtype = frmLoadin.ComLoadType.ListIndex

    End Sub 

    Private Sub CommandButTon1_Click()

    frmLoadTypes.Show

    End Sub 

    Private Sub CommandButTon4_Click()

    If  LdChange = 1 Then Call btnAdd_Click NoLoads = NoloadsStat

    If  NoLoads = 0 Then 

    frmLoadin.Hide

    Exit Sub 

    End If  

    For  I = 1 To NoLoads

    For  J = 1 To 5

    Loadin(J, I) = LoadinStat(J, I)

     Next J

     Next I

    Call Dinput

    Call Analyse

    Call WriteNote

    Call WriteReactn

    Call WriteMoms

    Call WriteGraphMoms

    Call ShearCalcs

    Call WriteShears

    Call WriteGraphShears

    Call WriteMaxMom

    frmLoadin.Hide

    End Sub 

    Private Sub edtIntensity_Change()

    LdChange = 1

    End Sub 

    Private Sub edtLenUdl_Change()

    LdChange = 1

    End Sub 

    Private Sub edtStrtDist_Change()

  • 8/18/2019 Formula VBA vigas

    9/41

    LdChange = 1

    End Sub 

    Private Sub UserForm_Activate()

    End Sub 

    Private Sub UserForm_Click()

    End Sub 

    Private Sub UserForm_Initialize()

    End Sub 

    Private Sub CommandButTon1_Click()

    frmLoadTypes.Hide

    End Sub 

    Private Sub Image1_Click()

    End Sub 

  • 8/18/2019 Formula VBA vigas

    10/41

     

    Private Sub cmdCancel_Click()

    txtDist.Text = ""

    txtDist.SetFocus

    frmMomatPoint.Hide

    End Sub 

    Private Sub cmdOK_Click()

    Dim hogsag As String, Shr1 As Single 

    SecCount = SecCount + 1

    If  txtDist.Value "" Then 

    Sectn = txtDist.Value

    If  TotSpn < Sectn Then 

    MsgBox "You have not specified a valid distance", 48, "Error"

    txtDist.Value = ""

    txtDist.SetFocus

    SecCount = SecCount - 1

    Exit Sub 

    End If  

    If  NoLoads = 0 Then MsgBox "You have not entered any loads, use the 'Add Loading' butTon first", 48, "Error"

    SecCount = SecCount - 1

    Call cmdCancel_Click

    Exit Sub 

    End If  

     NoSpnLd = 1

    For  I = 1 To NoSpn

    If  Lleft(I) < Sectn Then NoSpnLd = NoSpnLd + 1

     Next I

  • 8/18/2019 Formula VBA vigas

    11/41

     

    Call MomAtSection

    Mom = Round(Mom, 3)

    If  SecCount = 1 Then 

    Worksheets("Line Beam").Cells(LineC + 34 + SecCount, 2).HorizontalAlignment = xlRight

    Worksheets("Line Beam").Cells(LineC + 34 + SecCount, 2) = "Distance from LHE"

    Worksheets("Line Beam").Cells(LineC + 34 + SecCount, 3) = "Moment"

    Worksheets("Line Beam").Cells(LineC + 34 + SecCount, 4) = "Shear"

    End If  

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 2).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 2).NumberFormat = "General"

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 2).Select 

    cmdUp.Visible = True 

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 2) = Sectn

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 3).NumberFormat = "General"

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 3) = -Mom

    If  Sectn < 0.0001 Then 

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 4).NumberFormat = "General"

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 4) = "0"

    Sectn = 0.00001Call ShearAtSection

    Shr = Round(Shr, 3)

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 5).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 5).NumberFormat = "General"

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 5) = "& " & Shr

    Exit Sub 

    End If  

    If  Sectn = TotSpn Then 

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 5).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 5).NumberFormat = "General"

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 5) = "& 0"

    Call ShearAtSection

    Shr = Round(Shr, 3)

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 4).NumberFormat = "General"

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 4) = Shr

    End If  

    If  Sectn < TotSpn And Sectn > 0 Then 

    Call ShearAtSection

    Shr1 = Shr

    Shr = Round(Shr, 3)

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 4).NumberFormat = "General"

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 4) = Shr

    Sectn = Sectn + 0.0000001 NoSpnLd = 1

    For  I = 1 To NoSpn

    If  Lleft(I) < Sectn Then NoSpnLd = NoSpnLd + 1

     Next I

    Call ShearAtSection

    If  Abs(Shr1 - Shr) > 0.0005 Then 

    Shr = Round(Shr, 3)

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 5).NumberFormat = "General"

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 5).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC + 35 + SecCount, 5) = "& " & Shr

  • 8/18/2019 Formula VBA vigas

    12/41

      End If  

    End If  

    txtDist.Value = ""

    txtDist.SetFocus

    Else 

    SecCount = SecCount - 1

    End If  

    End Sub 

    Private Sub cmdUp_Click()

    Worksheets("Line Beam").Cells(1, 1).Select 

    cmdUp.Visible = False 

    End Sub 

    Private Sub txtDist_Change()

    End Sub 

    Private Sub UserForm_Activate()

    txtDist.SetFocus

    End Sub 

    Private Sub UserForm_Click()

    End Sub 

    Private Sub UserForm_Initialize()

    End Sub 

  • 8/18/2019 Formula VBA vigas

    13/41

    Private Sub cmdOK_Click()

    frmMovinLoads.Hide

    End Sub 

    Private Sub cmdCancel_Click()

    txtNoAxles.SetFocus

    frmNoAxles.Hide

    frmLoadin.ComLoadType.ListIndex = 0

    frmLoadin.cmbSpanNo.ListIndex = 0

  • 8/18/2019 Formula VBA vigas

    14/41

    frmLoadin.Show

    End Sub 

    Private Sub cmdOK_Click()

    If  txtNoAxles.Text = "" Then 

    txtNoAxles.SetFocus

    frmNoAxles.Hide

    frmLoadin.ComLoadType.ListIndex = 0

    frmLoadin.cmbSpanNo.ListIndex = 0frmLoadin.Show

    Else 

    AXles = txtNoAxles.Value

    frmVehicle.edtWheel.Value = ""

    frmVehicle.edtWspacing.Value = ""

    If  AXles = 1 Then 

    frmVehicle.edtWspacing.Visible = False 

    frmVehicle.lblAxleSpacing.Visible = False 

    frmVehicle.cmdAdd.Enabled = False 

    Else 

    frmVehicle.cmdAdd.Enabled = True 

    frmVehicle.edtWspacing.Visible = True frmVehicle.lblAxleSpacing.Visible = True 

    End If  

    AxleCount = 1

    VehicleL = 0

    frmNoAxles.Hide

    frmVehicle.Show

    End If  

    End Sub 

    Private Sub cmdOK_Click()

    frmSpans.Hide

    End Sub 

  • 8/18/2019 Formula VBA vigas

    15/41

     

    Private Sub cmdAdd_Click()

    If  AxleCount + 1 > AXles Then Exit Sub 

    If  AXles = 0 Then Exit Sub 

    If  AxleCount = AXles - 1 Then 

    edtWspacing.Visible = False 

    lblAxleSpacing.Visible = False 

    cmdAdd.Enabled = False 

    End If  

    If  edtWheel.Value = "" Then 

    MsgBox "Enter a Value For  the Axle Load"

    edtWheel.SetFocus

    Exit Sub 

    End If  

    If  AxleCount AXles Then 

    If  edtWspacing.Value = "" Then 

    MsgBox "Enter a Value For  Spacing To  Next Axle"

    edtWspacing.SetFocus

    Exit Sub End If  

    End If  

    Vehicle(AxleCount, 1) = edtWheel.Value

    edtWheel.Value = ""

    Vehicle(AxleCount, 2) = VehicleL

    VehicleL = VehicleL + edtWspacing.Value

    edtWspacing.Value = ""

    AxleCount = AxleCount + 1

    lblAxleNo.Caption = "W" & AxleCount

  • 8/18/2019 Formula VBA vigas

    16/41

    edtWheel.SetFocus

    End Sub 

    Private Sub cmdCancel_Click()

    frmVehicle.Hide

    End Sub 

    Private Sub cmdOK_Click()If  AxleCount < AXles Then Exit Sub 

    Vehicle(AxleCount, 1) = edtWheel.Value

    Vehicle(AxleCount, 2) = VehicleL

    frmVehicle.Hide

    Call MovinVehicle

    End Sub 

    MODULOS

    Modulo 1

    Public L(1 To 10) As Single, EIStrt(1 To 10) As Single, EI(1 To 10) As Single, KEI(1 To 10, 1 To 2) As Double 

    Public J As Integer , N As Integer , FEM(1 To 10, 1 To 2) As Double, FEM1(1 To 10, 1 To 2) As Double, FEM2(1 To 10, 1 To 2) As 

    Double 

    Public NoSpn As Integer , flage As Integer , Sectn As Single, smallEI As Double, TotSpn As Single 

    Public FEML As Double, FEMR As Double, Intensity As Single 

    Public a As Single, b As Single, c As Single, d As Single, e As Single, spnNo As Integer , Accurcy As Double, Icount As Integer  

    Public Rv(1 To 11) As Double, Lleft(1 To 10) As Single 

    Public NoLoads As Integer , OpeninFlag As Integer , TotLoad As Double 

    Public MomTable(1 To 11, 1 To 10) As Double, Mom As Double, ShearTable(1 To 11, 1 To 10) As Double, Shr As Double,

     NoSpnLd As Integer , MomGraph(1 To 200, 1 To 2) As Double, Mmax As Double, ShearGraph(1 To 200, 1 To 2) As Double,

    MomMax(1 To 10, 1 To 2) As Double 

    Public Vehicle(1 To 50, 1 To 2) As Single, AXles As Integer , AxleCount As Integer , VehicleL As Double 

    Public LineC As Integer  

    Public I As Integer , K As Integer , KLOAD As Integer  

    Public NoloadsOld As Integer , NoloadsStat As Integer , NoloadsMove As Integer  

    Public Xgraph As Single, Rowe As Integer , RoweTemp As Integer , Flagg As Integer , Sherone As Double, Shertwo As Double, Xone

    As Double, Xtwo As Double 

    Public ShearFlag(1 To 10) As Integer , FlagShr As Integer , Ish As Integer , ShearDiff(1 To 10, 1 To 2) As Double, ShearX1 As 

    Double, ShearY1 As Double, ShearY2 As Double, Sheardx As Double, SecndDiff As Double, Px As Double, Ax As Double, Bx As 

    Double, Cx As Double 

    Public Xsection As Double, AvInc As Double, LdInc As Integer  

    Public Loadin(1 To 5, 1 To 100) As Single, LoadinStat(1 To 5, 1 To 100) As Single, Ldtype As Single 

    Public MaxMoveMom(1 To 42, 1 To 3) As Double, Jx As Integer , Jv As Integer , Ix As Integer  Public LdChange As Integer , SecCount As Integer , LoadDes As String 

    Sub FitBeamMembers()

    For  I = 1 To 10

    Worksheets("Line Beam").Shapes("spn(" & I & ")").Visible = True 

    Worksheets("Line Beam").Shapes("arow(" & I & ")").Visible = True 

    Worksheets("Line Beam").Shapes("spn(" & I & ")").Left = (1 + I) * 48

  • 8/18/2019 Formula VBA vigas

    17/41

    Worksheets("Line Beam").Shapes("spn(" & I & ")").Top = 50

    Worksheets("Line Beam").Shapes("arow(" & I & ")").Left = (1 + I) * 48

    Worksheets("Line Beam").Shapes("arow(" & I & ")").Top = 50

     Next I

    Worksheets("Line Beam").Range("A11:M200").Value = ""

    Worksheets("Graph Data").Range("A4:G250").Value = ""

    Worksheets("Line Beam").Range("C4:L5").Borders(xlDiagonalDown).LineStyle = xlNone

    Worksheets("Line Beam").Range("C4:L5").Borders(xlDiagonalUp).LineStyle = xlNone

    With Worksheets("Line Beam").Range("C4:L5").Borders(xlEdgeLeft)

    .LineStyle = xlContinuous

    .Weight = xlThin

    .ColorIndex = 15

    End With 

    With Worksheets("Line Beam").Range("C4:L5").Borders(xlEdgeTop)

    .LineStyle = xlContinuous

    .Weight = xlThin

    .ColorIndex = 15

    End With With Worksheets("Line Beam").Range("C4:L5").Borders(xlEdgeBotTom)

    .LineStyle = xlContinuous

    .Weight = xlThin

    .ColorIndex = 15

    End With 

    With Worksheets("Line Beam").Range("C4:L5").Borders(xlEdgeRight)

    .LineStyle = xlContinuous

    .Weight = xlThin

    .ColorIndex = 15

    End With 

    With Worksheets("Line Beam").Range("C4:L5").Borders(xlInsideVertical)

    .LineStyle = xlContinuous

    .Weight = xlThin

    .ColorIndex = 15

    End With 

    With Worksheets("Line Beam").Range("C4:L5").Borders(xlInsideHorizontal)

    .LineStyle = xlContinuous

    .Weight = xlThin

    .ColorIndex = 15

    End With 

    With Worksheets("Line Beam").Range("C4:L5").Interior

    .ColorIndex = 19

    .Pattern = xlSolid

    .PatternColorIndex = xlAuTomatic

    End With 

    Worksheets("Line Beam").Cells(1, 3).Select 

    Worksheets("Line Beam").Shapes("arow(11)").Visible = True 

    Worksheets("Line Beam").Shapes("arow(11)").Left = 576

    Worksheets("Line Beam").Shapes("arow(11)").Top = 50

    With Worksheets("Line Beam")

    .Shapes("txtboxRH").Left = 581

  • 8/18/2019 Formula VBA vigas

    18/41

      .Shapes("txtboxRH").Top = 40

    .Shapes("txtboxLH").Left = 25

    .Shapes("txtboxLH").Top = 40

    End With 

     NoLoads = 0

    OpeninFlag = 0

    End Sub 

    Sub Dinput()

    OpeninFlag = OpeninFlag + 1

    'Shift all span lengths & EI values To the left so there are no intermediate zero values

    For  J = 1 To 10

    For  I = 1 To 10

    If  Worksheets("Line Beam").Cells(4, 2 + I) = 0 Then 

    Worksheets("Line Beam").Cells(4, 2 + I) = Worksheets("Line Beam").Cells(4, 3 + I).Value

    Worksheets("Line Beam").Cells(4, 3 + I) = ""

    Worksheets("Line Beam").Cells(5, 2 + I) = Worksheets("Line Beam").Cells(5, 3 + I).Value

    Worksheets("Line Beam").Cells(5, 3 + I) = ""End If  

     Next I

     Next J

    'Check that there are values For span & EI

    For  I = 1 To 10

    If  Worksheets("Line Beam").Cells(4, 2 + I) 0 And Worksheets("Line Beam").Cells(5, 2 + I) = 0 Then 

    MsgBox ("You need To enter a value For  EI in Span No " & I)

    Exit Sub 

    End If  

    If  Worksheets("Line Beam").Cells(5, 2 + I) 0 And Worksheets("Line Beam").Cells(4, 2 + I) = 0 Then 

    MsgBox ("You need To enter a value of Span Length in Span No " & I)

    Exit Sub 

    End If  

     Next I

    'Input data For span length And EI And determine No of Spans

    TotSpn = 0

    For  I = 1 To 10

    L(I) = Worksheets("Line Beam").Cells(4, 2 + I).Value

    TotSpn = TotSpn + L(I)

    EIStrt(I) = Worksheets("Line Beam").Cells(5, 2 + I).Value

    If  L(I) 0 Then  NoSpn = I

    Worksheets("Line Beam").Cells(3, 2 + I) = I

    End If  

     Next I

    'Delete unwanted span No's And clear cell colour And borders

    For  I = NoSpn To 10

    Worksheets("Line Beam").Cells(3, 3 + I) = ""

    Worksheets("Line Beam").Cells(6, 3 + I) = ""

    Worksheets("Line Beam").Cells(4, 3 + I).Interior.ColorIndex = xlNone

  • 8/18/2019 Formula VBA vigas

    19/41

    Worksheets("Line Beam").Cells(5, 3 + I).Interior.ColorIndex = xlNone

    Worksheets("Line Beam").Cells(4, 3 + I).Borders(xlDiagonalDown).LineStyle = xlNone

    Worksheets("Line Beam").Cells(4, 3 + I).Borders(xlDiagonalUp).LineStyle = xlNone

    Worksheets("Line Beam").Cells(4, 3 + I).Borders(xlEdgeLeft).LineStyle = xlNone

    Worksheets("Line Beam").Cells(4, 3 + I).Borders(xlEdgeTop).LineStyle = xlNone

    Worksheets("Line Beam").Cells(4, 3 + I).Borders(xlEdgeBotTom).LineStyle = xlNone

    Worksheets("Line Beam").Cells(4, 3 + I).Borders(xlEdgeRight).LineStyle = xlNone

    Worksheets("Line Beam").Cells(4, 3 + I).Borders(xlInsideVertical).LineStyle = xlNone

    Worksheets("Line Beam").Cells(4, 3 + I).Borders(xlInsideHorizontal).LineStyle = xlNoneWorksheets("Line Beam").Cells(5, 3 + I).Borders(xlDiagonalDown).LineStyle = xlNone

    Worksheets("Line Beam").Cells(5, 3 + I).Borders(xlDiagonalUp).LineStyle = xlNone

    Worksheets("Line Beam").Cells(5, 3 + I).Borders(xlEdgeLeft).LineStyle = xlNone

    Worksheets("Line Beam").Cells(5, 3 + I).Borders(xlEdgeTop).LineStyle = xlNone

    Worksheets("Line Beam").Cells(5, 3 + I).Borders(xlEdgeBotTom).LineStyle = xlNone

    Worksheets("Line Beam").Cells(5, 3 + I).Borders(xlEdgeRight).LineStyle = xlNone

    Worksheets("Line Beam").Cells(5, 3 + I).Borders(xlInsideVertical).LineStyle = xlNone

    Worksheets("Line Beam").Cells(5, 3 + I).Borders(xlInsideHorizontal).LineStyle = xlNone

     Next I

    For  I = NoSpn + 1 To 10

    Worksheets("Line Beam").Shapes("spn(" & I & ")").Visible = False 

    Worksheets("Line Beam").Shapes("arow(" & I + 1 & ")").Visible = False  Next I

    With Worksheets("Line Beam")

    .Shapes("txtboxRH").Left = (2 + NoSpn) * 48 + 5

    .Shapes("txtboxRH").Top = 40

    End With 

    If  NoSpn > 1 Then 

    For  I = 1 To NoSpn

    EI(I) = EIStrt(I)

     Next I

    'Reduce EI/L's To relative EI/L's

    smallEI = EI(1)

    For  I = 2 To NoSpn

    If  EI(I) < smallEI Then smallEI = EI(I)

     Next I

    For  I = 1 To NoSpn

    EI(I) = EI(I) / smallEI / L(I)

    Worksheets("Line Beam").Cells(6, 2 + I).NumberFormat = "0.000"

    Worksheets("Line Beam").Cells(6, 2 + I).Value = EI(I)

     Next I

    'Module2

    Call distribution 'Calculate distribution facTors 

    End If  

    'Calculate accumulative distance from left hand End 

  • 8/18/2019 Formula VBA vigas

    20/41

      For  I = 1 To 10

    Lleft(I) = 0

     Next I

    Lleft(1) = L(1)

    If  NoSpn > 1 Then 

    For  I = 2 To NoSpn

    Lleft(I) = Lleft(I - 1) + L(I)

     Next I

    End If  

    End Sub 

    Modulo 2

    Sub distribution()

    'zero arrays

    For  I = 1 To 10

    For  J = 1 To 2

    KEI(I, J) = 0

    FEM(I, J) = 0 Next J

     Next I

    'Refix EI reduced values

    For  I = 1 To NoSpn

    EI(I) = Worksheets("Line Beam").Cells(6, 2 + I).Value

     Next I

    'Calculate distribution facTors

    'Check End conditions For  pinned or fixed

    If  Worksheets("Line Beam").OptionButTons("OPTlhfixed").Value = xlOn Then KEI(1, 1) = 0

    If  Worksheets("Line Beam").OptionButTons("OPTlhpin").Value = xlOn Then 

    KEI(1, 1) = 1

    EI(1) = 0.75 * EI(1)

    End If  

    If  Worksheets("Line Beam").OptionButTons("OPTrhfixed").Value = xlOn Then KEI(NoSpn, 2) = 0

    If  Worksheets("Line Beam").OptionButTons("OPTrhpin").Value = xlOn Then 

    KEI(NoSpn, 2) = 1

    EI(NoSpn) = 0.75 * EI(NoSpn)

    End If  

    KEI(1, 2) = EI(1) / (EI(1) + EI(2))

    KEI(NoSpn, 1) = EI(NoSpn) / (EI(NoSpn) + EI(NoSpn - 1))

    If  NoSpn > 2 Then 

    For  I = 2 To NoSpn - 1

    KEI(I, 1) = EI(I) / (EI(I - 1) + EI(I))

    KEI(I, 2) = EI(I) / (EI(I) + EI(I + 1))

     Next I

    End If  

    End Sub 

  • 8/18/2019 Formula VBA vigas

    21/41

    Modulo 3

    Sub FixdEndMomPoint()

    FEML = -Intensity * a * b ^ 2 / L(spnNo) ^ 2

    FEMR = Intensity * b * a ^ 2 / L(spnNo) ^ 2

    End Sub 

    Sub FixdEndMomFull()

    FEML = -Intensity * L(spnNo) ^ 2 / 12

    FEMR = Intensity * L(spnNo) ^ 2 / 12End Sub 

    Sub FixdEndMomPart()

    FEML = -Intensity * (e ^ 3 * (4 * L(spnNo) - 3 * e) - c ^ 3 * (4 * L(spnNo) - 3 * c)) / 12 / L(spnNo) ^ 2

    FEMR = Intensity * (d ^ 3 * (4 * L(spnNo) - 3 * d) - a ^ 3 * (4 * L(spnNo) - 3 * a)) / 12 / L(spnNo) ^ 2

    End Sub 

    Sub FixdEndMomInc()

    FEML = -Intensity * L(spnNo) ^ 2 / 30

    FEMR = Intensity * L(spnNo) ^ 2 / 20

    End Sub 

    Sub FixdEndMomDec()

    FEML = -Intensity * L(spnNo) ^ 2 / 20

    FEMR = Intensity * L(spnNo) ^ 2 / 30End Sub 

    Sub FixdEndMomTri()

    FEML = -5 * Intensity * L(spnNo) ^ 2 / 96

    FEMR = 5 * Intensity * L(spnNo) ^ 2 / 96

    End Sub 

    Sub FixdEndMomSettl()

    FEML = -6 * Intensity / 1000 * EIStrt(spnNo) / L(spnNo) ^ 2

    FEMR = FEML

    End Sub 

    Sub Distribute()

    Icount = 0

    Line1:

    Accurcy = 0.00000000001

    Icount = Icount + 1

    If  Icount > 100 Then 

    'MsgBox Icount

    Exit Sub 

    End If  

    'ReleAse jointFEM1(1, 1) = -KEI(1, 1) * FEM(1, 1)

    FEM1(1, 2) = -KEI(1, 2) * (FEM(1, 2) + FEM(2, 1))

    FEM1(NoSpn, 1) = -KEI(NoSpn, 1) * (FEM(NoSpn - 1, 2) + FEM(NoSpn, 1))

    FEM1(NoSpn, 2) = -KEI(NoSpn, 2) * FEM(NoSpn, 2)

    If  NoSpn > 2 Then 

    For  N = 2 To NoSpn - 1

    FEM1(N, 1) = -KEI(N, 1) * (FEM(N - 1, 2) + FEM(N, 1))

    FEM1(N, 2) = -KEI(N, 2) * (FEM(N, 2) + FEM(N + 1, 1))

     Next N

  • 8/18/2019 Formula VBA vigas

    22/41

    End If  

    'Carry over

    For  N = 1 To NoSpn

    If  KEI(N, 1) 1 Then FEM2(N, 1) = 0.5 * FEM1(N, 2)

    If  KEI(N, 2) 1 Then FEM2(N, 2) = 0.5 * FEM1(N, 1)

     Next N

    'Sum moments at supports

    For  N = 1 To NoSpn

    FEM(N, 1) = FEM(N, 1) + FEM1(N, 1) + FEM2(N, 1)

    FEM(N, 2) = FEM(N, 2) + FEM1(N, 2) + FEM2(N, 2)

     Next N

    'Check accuracy of carry over

    For  N = 1 To NoSpn

    If  Abs(FEM2(N, 1)) > 0.000000001 Then Accurcy = Abs(FEM2(N, 1))

    If  Abs(FEM2(N, 2)) > 0.000000001 Then Accurcy = Abs(FEM2(N, 2))

     Next N

    'Loop until accuracy < 0.000000001

    If  Accurcy > 0.000000001 Then 

    GoTo Line1

    Else 

    Exit Sub 

    End If  

    End Sub 

    Sub OneSpan()

    'Check End conditions For pinned or fixed

    If  Worksheets("Line Beam").OptionButTons("OPTlhfixed").Value = xlOn Then KEI(1, 1) = 0

    If  Worksheets("Line Beam").OptionButTons("OPTlhpin").Value = xlOn Then KEI(1, 1) = 1

    If  Worksheets("Line Beam").OptionButTons("OPTrhfixed").Value = xlOn Then KEI(NoSpn, 2) = 0

    If  Worksheets("Line Beam").OptionButTons("OPTrhpin").Value = xlOn Then KEI(1, 2) = 1

    If  KEI(1, 1) = 0 And KEI(1, 2) = 1 Then 

    FEM(1, 1) = FEM(1, 1) - FEM(1, 2) / 2

    FEM(1, 2) = 0

    End If  

    If  KEI(1, 1) = 1 And KEI(1, 2) = 0 Then 

    FEM(1, 2) = FEM(1, 2) - FEM(1, 1) / 2

    FEM(1, 1) = 0

    End If  

    If  KEI(1, 1) = 1 And KEI(1, 2) = 1 Then 

    FEM(1, 1) = 0

    FEM(1, 2) = 0

    End If  

    End Sub 

  • 8/18/2019 Formula VBA vigas

    23/41

    Sub Analyse()

    'Module3

    TotLoad = 0

    For  I = 1 To NoSpn

    FEM(I, 1) = 0

    FEM(I, 2) = 0

     Next I

    If  NoSpn > 1 Then Call distribution

    For  I = 1 To NoLoads

    spnNo = Loadin(1, I)

    Intensity = Loadin(3, I)

    Select Case Loadin(2, I)

    Case 1 'Point Load 

    a = Loadin(4, I)

     b = L(spnNo) - a

    TotLoad = TotLoad + Intensity

    Call FixdEndMomPoint

    Case 2 'Full UDL TotLoad = TotLoad + Intensity * L(spnNo)

    Call FixdEndMomFull

    Case 3 'Part UDL 

    a = Loadin(4, I)

     b = Loadin(5, I)

    c = L(spnNo) - a - b

    d = a + b

    e = b + c

    TotLoad = TotLoad + Intensity * b

    Call FixdEndMomPart

    Case 4 'IncreAsing Load 

    TotLoad = TotLoad + Intensity * L(spnNo) / 2

    Call FixdEndMomInc

    Case 5 'DecreAsing Load

    TotLoad = TotLoad + Intensity * L(spnNo) / 2

    Call FixdEndMomDec

    Case 6 'Triangular Load 

    TotLoad = TotLoad + Intensity * L(spnNo) / 2

    Call FixdEndMomTri

    Case 7 'Settlement at support 

    Call FixdEndMomSettl

    End Select 

    FEM(spnNo, 1) = FEM(spnNo, 1) + FEML

    FEM(spnNo, 2) = FEM(spnNo, 2) + FEMR

     Next I

    If  NoSpn > 1 Then 

  • 8/18/2019 Formula VBA vigas

    24/41

     Call Distribute

    Else 

    Call OneSpan

    End If  

    Call Reactn

    End Sub 

    Sub ShearCalcs()

    'Calculate Shears

    For  J = 1 To NoSpn

     NoSpnLd = J

    If  J = 1 Then 

    Sectn = 0.00001

    Call ShearAtSection

    ShearTable(1, J) = Shr

    Sectn = Lleft(J) - 0.00001Call ShearAtSection

    ShearTable(11, J) = Shr

    Else 

    Sectn = 0.00001 + Lleft(J - 1)

    Call ShearAtSection

    ShearTable(1, J) = Shr

    Sectn = Lleft(J) - 0.00001

    Call ShearAtSection

    ShearTable(11, J) = Shr

    End If  

    For  I = 1 To 9

    If  J = 1 Then 

    Sectn = I * L(1) / 10

    Else 

    Sectn = I * L(J) / 10 + Lleft(J - 1)

    End If  

    Call ShearAtSection 'Module8

    ShearTable(I + 1, J) = Shr

     Next I

     Next J

    'Calculate Shear values For graph table

    For  I = 1 To 200

    For  J = 1 To 2

    ShearGraph(I, J) = 0

     Next J

     Next I

  • 8/18/2019 Formula VBA vigas

    25/41

      Rowe = 1

    Xgraph = 0

    For  J = 1 To NoSpn

    Xgraph = Xgraph - 0.1 * L(J)

    For  I = 1 To 11

    Rowe = Rowe + 1

    Xgraph = Xgraph + 0.1 * L(J)

    ShearGraph(Rowe, 1) = Xgraph

    ShearGraph(Rowe, 2) = ShearTable(I, J) Next I

     Next J

    Rowe = Rowe + 1

    Xgraph = Lleft(NoSpn)

    ShearGraph(Rowe, 1) = Xgraph

    ShearGraph(Rowe, 2) = 0

    'Calculate Shears For point load positions

    For  I = 1 To NoLoads

    If  Loadin(2, I) = 1 Then 

    Rowe = Rowe + 2

    Sectn = Lleft(Loadin(1, I)) - L(Loadin(1, I)) + Loadin(4, I) - 0.0001 NoSpnLd = Loadin(1, I)

    Call ShearAtSection

    Flagg = 0

    'Enter one or two extra rows where point load occurs 

    For  J = 1 To Rowe

    If  Flagg = 0 Then 

    If  Round((Sectn + 0.0001), 4) = Round(ShearGraph(J, 1), 4) Then 

    For  N = Rowe To J + 1 Step -1

    ShearGraph(N, 1) = ShearGraph(N - 1, 1)

    ShearGraph(N, 2) = ShearGraph(N - 1, 2)

     Next N

    Flagg = J + 1000

    Else 

    If  Sectn + 0.0001 < ShearGraph(J, 1) Then 

    For  N = Rowe To J + 2 Step -1

    ShearGraph(N, 1) = ShearGraph(N - 2, 1)

    ShearGraph(N, 2) = ShearGraph(N - 2, 2)

     Next N

    Flagg = J

    End If  

    End If  

    End If  

     Next JIf  Flagg < 1000 Then 

    ShearGraph(Flagg, 1) = Sectn + 0.0001

    ShearGraph(Flagg, 2) = Shr

    ShearGraph(Flagg + 1, 1) = Sectn + 0.0001

    ShearGraph(Flagg + 1, 2) = Shr + Loadin(3, I)

    Else 

    ShearGraph(Flagg - 999, 1) = Sectn + 0.0001

    ShearGraph(Flagg - 999, 2) = Shr + Loadin(3, I)

    End If  

    End If  

  • 8/18/2019 Formula VBA vigas

    26/41

       Next I

    'Find position of zero shear For max moments

    For  J = 1 To NoSpn

    'Check For load types 4, 5 And 6 (nonlinear shear graph)

    FlagShr = 0For  Ish = 1 To NoLoads

    If  Loadin(1, Ish) = J Then 

    If  Loadin(2, Ish) > 3 And Loadin(2, Ish) < 7 Then FlagShr = 1

    End If  

     Next Ish

     NoSpnLd = J

    ShearFlag(J) = 0

    For  I = 2 To 11

    If  Round(ShearTable(I, J), 6) = 0 Then 

    If  I 11 Then 

    Sectn = Lleft(J) - L(J) + 0.1 * (I - 1) * L(J)

    Call MomAtSection 'Module7 MomMax(J, 1) = -Mom

    MomMax(J, 2) = Sectn

    ShearFlag(J) = 1

    End If  

    Else 

    If  ShearTable(I - 1, J) * ShearTable(I, J) < 0 Then 

    ShearX1 = Lleft(J) - L(J) + 0.1 * (I - 2) * L(J)

    ShearY1 = ShearTable(I - 1, J)

    ShearY2 = ShearTable(I, J)

    Sheardx = 0.1 * L(J)

    If  FlagShr = 1 Then 

    For  Ish = 1 To 10

    ShearDiff(Ish, 1) = ShearTable(Ish + 1, J) - ShearTable(Ish, J)

     Next Ish

    For  Ish = 1 To 4

    ShearDiff(Ish, 2) = ShearDiff(Ish + 1, 1) - ShearDiff(Ish, 1)

    ShearDiff(5 + Ish, 2) = ShearDiff(Ish + 6, 1) - ShearDiff(Ish + 5, 1)

     Next Ish

    If  I > 6 Then 

    SecndDiff = (ShearDiff(6, 2) + ShearDiff(7, 2) + ShearDiff(8, 2) + ShearDiff(9, 2)) / 4

    Else 

    SecndDiff = (ShearDiff(1, 2) + ShearDiff(2, 2) + ShearDiff(3, 2) + ShearDiff(4, 2)) / 4

    End If  Ax = SecndDiff / 2

    Bx = -(ShearY1 - ShearY2) - SecndDiff / 2

    Cx = ShearY1

    Px = (-Bx + (Bx ^ 2 - 4 * Ax * Cx) ^ 0.5) / 2 / Ax * Sheardx

    Sectn = ShearX1 + Px

    Else 

    Sectn = ShearX1 + Sheardx * ShearY1 / (ShearY1 - ShearY2)

    End If  

    Call MomAtSection 'Module7 

    MomMax(J, 1) = -Mom

  • 8/18/2019 Formula VBA vigas

    27/41

      MomMax(J, 2) = Sectn

    ShearFlag(J) = 1

    End If  

    End If  

     Next I

     Next J

    'Check ShearGraph To see If point loads affect the max moment

    For  J = 1 To NoSpn

     NoSpnLd = J

    For  I = 1 To Rowe - 1

    If  Round(ShearGraph(I, 1), 5) > Round((Lleft(J) - L(J)), 5) And Round(ShearGraph(I + 1, 1), 5) < Round(Lleft(J), 5) Then 

    If  Round(ShearGraph(I, 1), 5) = Round(ShearGraph(I + 1, 1), 5) Then 

    Sectn = ShearGraph(I, 1)

    Call MomAtSection 'Module7 

    If  Abs(Mom) > Abs(MomMax(J, 1)) Then 

    MomMax(J, 1) = -Mom

    MomMax(J, 2) = Sectn

    End If  

    End If  End If  

     Next I

     Next J

    End Sub 

    Modulo 4

    Sub Reactn()

    Dim Ntmes As Integer , La As Double, Spannon As Integer  

    'zero array

    For  N = 1 To NoSpn + 1

    Rv(N) = 0

     Next N

    'calclate reactions

    Rv(NoSpn + 1) = TotLoad

    For  N = 1 To NoSpn

    Rv(N) = -FEM(1, 1) - FEM(N, 2)

    For  J = 1 To NoLoads

    Spannon = Loadin(1, J)

    Select Case Loadin(2, J)

    Case 1

     b = L(Spannon) - Loadin(4, J)

    If  Round(Lleft(Spannon) - b, 5) < Lleft(N) - 0.0000001 Then Rv(N) = Rv(N) + (Lleft(N) - Lleft(Spannon) + b) * Loadin(3, J)

    Case 2

     b = L(Spannon)

    If  Round(Lleft(Spannon) - b, 5) < Lleft(N) - 0.0000001 Then Rv(N) = Rv(N) + (Lleft(N) - Lleft(Spannon) + b / 2) * Loadin(3, J)

    * b

  • 8/18/2019 Formula VBA vigas

    28/41

     

    Case 3

     b = L(Spannon) - Loadin(4, J)

    If  Round(Lleft(Spannon) - b, 5) < Lleft(N) - 0.0000001 Then Rv(N) = Rv(N) + (Lleft(N) - Lleft(Spannon) + b - Loadin(5, J) / 2)

    * Loadin(3, J) * Loadin(5, J)

    Case 4

     b = L(Spannon)

    If  Round(Lleft(Spannon) - b, 5) < Lleft(N) - 0.0000001 Then Rv(N) = Rv(N) + (Lleft(N) - Lleft(Spannon) + b / 3) * Loadin(3, J)

    * b / 2Case 5

     b = L(Spannon)

    If  Round(Lleft(Spannon) - b, 5) < Lleft(N) - 0.0000001 Then Rv(N) = Rv(N) + (Lleft(N) - Lleft(Spannon) + 2 * b / 3) *

    Loadin(3, J) * b / 2

    Case 6

     b = L(Spannon)

    If  Round(Lleft(Spannon) - b, 5) < Lleft(N) - 0.0000001 Then Rv(N) = Rv(N) + (Lleft(N) - Lleft(Spannon) + b / 2) * Loadin(3, J)

    * b / 2

    'Case 7

    ' b = L(Spannon)

    ' If  Lleft(Spannon) - b < Lleft(N) - 0.0000001 Then Rv(N) = Rv(N)

    End Select 

     Next J

    If  N > 1 Then 

    For  Ntmes = 1 To N - 1

    If  Ntmes = 1 Then 

    La = Lleft(N)

    Else 

    La = Lleft(N) - Lleft(Ntmes - 1)

    End If  

    Rv(N) = Rv(N) - Rv(Ntmes) * La

     Next Ntmes

    End If  

    Rv(N) = Rv(N) / L(N)

    Rv(NoSpn + 1) = Rv(NoSpn + 1) - Rv(N)

     Next N

    End Sub 

    Modulo 5

    Sub MovinVehicle()

    For  I = 1 To 2 * (NoSpn * 2 + 1)

    For  J = 1 To 2

    MaxMoveMom(I, J) = 0

     Next J

     Next I

    AvInc = TotSpn / NoSpn / 10

    LdInc = Int(Vehicle(AXles, 2) / AvInc) + 1

    Xsection = 0

  • 8/18/2019 Formula VBA vigas

    29/41

    For  Jv = 1 To (NoSpn * 10 + LdInc)

    Xsection = Xsection + AvInc

     NoloadsMove = 0

    Call SortVehLoad

     NoLoads = NoloadsMove

    Call Analyse

    'Calculate Moments

    If  -FEM(1, 1) > MaxMoveMom(1, 1) Then 

    MaxMoveMom(1, 1) = -FEM(1, 1)

    MaxMoveMom(1, 2) = 0

    MaxMoveMom(1, 3) = Xsection

    End If  

    If  -FEM(1, 1) < MaxMoveMom(2, 1) Then 

    MaxMoveMom(2, 1) = -FEM(1, 1)

    MaxMoveMom(2, 2) = 0

    MaxMoveMom(2, 3) = Xsection

    End If  For  Jx = 1 To NoSpn

     NoSpnLd = Jx

    For  Ix = 1 To 9

    If  Jx = 1 Then 

    Sectn = Ix * L(1) / 10

    Else 

    Sectn = Ix * L(Jx) / 10 + Lleft(Jx - 1)

    End If  

    Call MomAtSection 'Module7 

    If  -Mom > MaxMoveMom(3 + 4 * (Jx - 1), 1) Then 

    MaxMoveMom(3 + 4 * (Jx - 1), 1) = -Mom

    MaxMoveMom(3 + 4 * (Jx - 1), 2) = Sectn

    MaxMoveMom(3 + 4 * (Jx - 1), 3) = Xsection

    End If  

    If  -Mom < MaxMoveMom(4 + 4 * (Jx - 1), 1) Then 

    MaxMoveMom(4 + 4 * (Jx - 1), 1) = -Mom

    MaxMoveMom(4 + 4 * (Jx - 1), 2) = Sectn

    MaxMoveMom(4 + 4 * (Jx - 1), 3) = Xsection

    End If  

     Next Ix

    Sectn = Lleft(Jx)Call MomAtSection 'Module7 

    If  -Mom > MaxMoveMom(5 + 4 * (Jx - 1), 1) Then 

    MaxMoveMom(5 + 4 * (Jx - 1), 1) = -Mom

    MaxMoveMom(5 + 4 * (Jx - 1), 2) = Sectn

    MaxMoveMom(5 + 4 * (Jx - 1), 3) = Xsection

    End If  

    If  -Mom < MaxMoveMom(6 + 4 * (Jx - 1), 1) Then 

    MaxMoveMom(6 + 4 * (Jx - 1), 1) = -Mom

    MaxMoveMom(6 + 4 * (Jx - 1), 2) = Sectn

    MaxMoveMom(6 + 4 * (Jx - 1), 3) = Xsection

  • 8/18/2019 Formula VBA vigas

    30/41

      End If  

     Next Jx

     Next Jv

    For  I = 1 To 6

    MsgBox MaxMoveMom(I, 1) & " " & MaxMoveMom(I, 2) & " " & MaxMoveMom(I, 3)

     Next I

    End Sub 

    Sub SortVehLoad()

    For  I = 1 To AXles

    Loadin(1, I) = 1

    For  KLOAD = 1 To NoSpn

    If  I = 1 Then 

    If  Xsection > Lleft(KLOAD) Then Loadin(1, I) = KLOAD + 1

    Else 

    If  Xsection - Vehicle(I - 1, 2) > Lleft(KLOAD) Then Loadin(1, I) = KLOAD + 1

    End If  

     Next KLOAD

    Loadin(2, I) = 1

    Loadin(3, I) = Vehicle(I, 1)If  Loadin(1, I) NoSpn Then Loadin(1, I) = 0

    If  Loadin(4, I) < 0 Then Loadin(1, I) = 0

    If  Loadin(1, I) 0 Then 

     NoloadsMove = NoloadsMove + 1

    Loadin(1, NoloadsMove) = Loadin(1, I)

    Loadin(2, NoloadsMove) = Loadin(2, I)

    Loadin(3, NoloadsMove) = Loadin(3, I)

    Loadin(4, NoloadsMove) = Loadin(4, I)

    End If  

     Next I

    End Sub 

    Modulo 6

    Sub LoadLoadData()Dim NospnNew As Integer , LoadDes As String 

    SecCount = 0

    LineC = 12

    If  OpeninFlag = 0 Then 

    Call Dinput

    Else 

     NospnNew = 0

  • 8/18/2019 Formula VBA vigas

    31/41

      For  I = 1 To 10

    If  Worksheets("Line Beam").Cells(4, 2 + I).Value 0 Then NospnNew = NospnNew + 1

     Next I

    If  NospnNew NoSpn Then  'Check To see If spans have been added or Subtracted

    Call FitBeamMembers

    Call Dinput

    End If  

    End If  

    If  NoSpn = 0 Then 

    MsgBox "Enter Beam Geometry First", 48, "Error"

    For  I = 1 To 10

    Worksheets("Line Beam").Cells(3, 2 + I) = I

    Worksheets("Line Beam").Cells(4, 2 + I) = ""

    Worksheets("Line Beam").Cells(5, 2 + I) = ""

    Worksheets("Line Beam").Cells(6, 2 + I) = ""

     Next I

    Call FitBeamMembers

    Worksheets("Line Beam").Cells(4, 3).Select 

    Exit Sub End If  

    'Input data For span length And EI And determine No of Spans

    TotSpn = 0

    For  I = 1 To 10

    L(I) = Worksheets("Line Beam").Cells(4, 2 + I).Value

    TotSpn = TotSpn + L(I)

    EIStrt(I) = Worksheets("Line Beam").Cells(5, 2 + I).Value

    If  L(I) 0 Then 

     NoSpn = I

    Worksheets("Line Beam").Cells(3, 2 + I) = I

    End If  

     Next I

    If  NoSpn > 1 Then 

    For  I = 1 To NoSpn

    EI(I) = EIStrt(I)

     Next I

    'Reduce EI/L's To relative EI/L's 

    smallEI = EI(1)

    For  I = 2 To NoSpnIf  EI(I) < smallEI Then smallEI = EI(I)

     Next I

    For  I = 1 To NoSpn

    EI(I) = EI(I) / smallEI / L(I)

    Worksheets("Line Beam").Cells(6, 2 + I).NumberFormat = "0.000"

    Worksheets("Line Beam").Cells(6, 2 + I).Value = EI(I)

     Next I

    'Module2 

    Call distribution 'Calculate distribution facTors

    End If  

  • 8/18/2019 Formula VBA vigas

    32/41

      'Calculate accumulative distance from left hand End

    For  I = 1 To 10

    Lleft(I) = 0

     Next I

    Lleft(1) = L(1)

    If  NoSpn > 1 Then 

    For  I = 2 To NoSpn

    Lleft(I) = Lleft(I - 1) + L(I)

     Next IEnd If  

    With frmLoadin

    .ComLoadType.List = Array("Load Type", "1 Point Load", "2 Full UDL", "3 Part UDL", "4 IncreAsing Load", "5 DecreAsing

    Load", "6 Triangular Load", "7 Settlement")

    .ComLoadType.ListIndex = 0

    .cmbSpanNo.Visible = False 

    .Label1.Caption = "Span No"

    .Label1.Visible = False 

    .edtIntensity.Text = ""

    .edtIntensity.Visible = False 

    .edtStrtDist.Text = ""

    .edtStrtDist.Visible = False 

    .edtLenUdl.Text = ""

    .edtLenUdl.Visible = False 

    .lblStrt.Visible = False 

    .lblLen.Visible = False 

    .lblLoad.Visible = False 

    End With 

    Worksheets("Line Beam").Range("A11:M200").Value = ""

    Worksheets("Line Beam").Range("A12:M200").HorizontalAlignment = xlCenter

    Worksheets("Line Beam").Cells(LineC - 1, 1).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC - 1, 1) = "Loading"

    Worksheets("Line Beam").Cells(LineC, 2) = "Span No"

    Worksheets("Line Beam").Cells(LineC, 3).HorizontalAlignment = xlRight

    Worksheets("Line Beam").Cells(LineC, 3) = "Load"

    Worksheets("Line Beam").Cells(LineC, 4).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC, 4) = " Type"

    Worksheets("Line Beam").Cells(LineC, 5) = "Intensity"Worksheets("Line Beam").Cells(LineC, 6) = "Dim 'a'"

    Worksheets("Line Beam").Cells(LineC, 7) = "Dim 'b'"

    LineC = LineC + 1

     NoloadsOld = NoloadsStat 'Used For Cancel function 

    If  NoloadsStat 0 Then 

    For  I = 1 To NoloadsStat

    Worksheets("Line Beam").Cells(LineC, 2).NumberFormat = "0"

    Worksheets("Line Beam").Cells(LineC, 2) = LoadinStat(1, I)

    Worksheets("Line Beam").Cells(LineC, 3).NumberFormat = "General"

  • 8/18/2019 Formula VBA vigas

    33/41

      Worksheets("Line Beam").Cells(LineC, 3).HorizontalAlignment = xlLeft

    Select Case LoadinStat(2, I)

    Case 1

    LoadDes = "Point Load"

    Case 2

    LoadDes = "Full UDL"

    Case 3

    LoadDes = "Part UDL"

    Case 4LoadDes = "IncreAsing Triangular Load"

    Case 5

    LoadDes = "DecreAsing Triangular Load"

    Case 6

    LoadDes = "Triangular Load"

    Case 7

    LoadDes = "Settlement"

    End Select 

    Worksheets("Line Beam").Cells(LineC, 3) = LoadDes

    Worksheets("Line Beam").Cells(LineC, 5).NumberFormat = "0.000"

    Worksheets("Line Beam").Cells(LineC, 5) = LoadinStat(3, I)

    If  LoadinStat(2, I) = 1 Or LoadinStat(2, I) = 3 Then Worksheets("Line Beam").Cells(LineC, 6).NumberFormat = "0.000"

    Worksheets("Line Beam").Cells(LineC, 6) = LoadinStat(4, I)

    End If  

    If  LoadinStat(2, I) = 3 Then 

    Worksheets("Line Beam").Cells(LineC, 7).NumberFormat = "0.000"

    Worksheets("Line Beam").Cells(LineC, 7) = LoadinStat(5, I)

    End If  

    LineC = LineC + 1

     Next I

    End If  

    frmLoadin.Show

    End Sub 

    Sub FillSpanCombo()

    With frmLoadin

    Select Case NoSpn

    Case 1

    .cmbSpanNo.List = Array("Span No.", "1")

    Case 2

    .cmbSpanNo.List = Array("Span No.", "1", "2")

    Case 3

    .cmbSpanNo.List = Array("Span No.", "1", "2", "3")Case 4

    .cmbSpanNo.List = Array("Span No.", "1", "2", "3", "4")

    Case 5

    .cmbSpanNo.List = Array("Span No.", "1", "2", "3", "4", "5")

    Case 6

    .cmbSpanNo.List = Array("Span No.", "1", "2", "3", "4", "5", "6")

    Case 7

    .cmbSpanNo.List = Array("Span No.", "1", "2", "3", "4", "5", "6", "7")

    Case 8

    .cmbSpanNo.List = Array("Span No.", "1", "2", "3", "4", "5", "6", "7", "8")

  • 8/18/2019 Formula VBA vigas

    34/41

    Case 9

    .cmbSpanNo.List = Array("Span No.", "1", "2", "3", "4", "5", "6", "7", "8", "9")

    Case 10

    .cmbSpanNo.List = Array("Span No.", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")

    End Select 

    End With 

    If  NoSpn = 1 Then 

    frmLoadin.cmbSpanNo.ListIndex = 1Else 

    frmLoadin.cmbSpanNo.ListIndex = 0

    End If  

    End Sub 

    Sub FillSupportCombo()

    With frmLoadin

    Select Case NoSpn

    Case 1

    .cmbSpanNo.List = Array("Support No.", "1", "2")

    Case 2

    .cmbSpanNo.List = Array("Support No.", "1", "2", "3")Case 3

    .cmbSpanNo.List = Array("Support No.", "1", "2", "3", "4")

    Case 4

    .cmbSpanNo.List = Array("Support No.", "1", "2", "3", "4", "5")

    Case 5

    .cmbSpanNo.List = Array("Support No.", "1", "2", "3", "4", "5", "6")

    Case 6

    .cmbSpanNo.List = Array("Support No.", "1", "2", "3", "4", "5", "6", "7")

    Case 7

    .cmbSpanNo.List = Array("Support No.", "1", "2", "3", "4", "5", "6", "7", "8")

    Case 8

    .cmbSpanNo.List = Array("Support No.", "1", "2", "3", "4", "5", "6", "7", "8", "9")

    Case 9

    .cmbSpanNo.List = Array("Support No.", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")

    Case 10

    .cmbSpanNo.List = Array("Support No.", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11")

    End Select 

    End With 

    frmLoadin.cmbSpanNo.ListIndex = 0

    End Sub 

    Modulo 7

    Sub MomAtSection()

    Dim LaMom As Double, Wi As Double, LdLen As Double 

    'Calculate moment due To distributed moments(FEM) And reactions

    If  NoSpnLd = 1 Then 

    Mom = FEM(1, 1) + Rv(1) * Sectn

    Else 

    Mom = FEM(1, 1) + Rv(1) * Sectn

    For  N = 2 To NoSpnLd

  • 8/18/2019 Formula VBA vigas

    35/41

      Mom = Mom + Rv(N) * (Sectn - Lleft(N - 1))

     Next N

    End If  

    'Calculate moments due To loads

    For  N = 1 To NoLoads

    If  Loadin(1, N) > NoSpnLd Then GoTo Line5

    Select Case Loadin(2, N)

    Case 1LaMom = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) + Loadin(4, N))

    If  LaMom > 0 Then 

    Mom = Mom - Loadin(3, N) * LaMom

    End If  

    Case 2

    If  NoSpnLd = Loadin(1, N) Then 

    LaMom = (Sectn - (Lleft(NoSpnLd) - L(NoSpnLd))) / 2

    Mom = Mom - Loadin(3, N) * LaMom ^ 2 * 2

    Else 

    LaMom = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) / 2)Mom = Mom - Loadin(3, N) * LaMom * L(Loadin(1, N))

    End If  

    Case 3

    LaMom = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) + Loadin(4, N) + Loadin(5, N) / 2)

    If  NoSpnLd = Loadin(1, N) Then 

    If  LaMom > 0 Then 

    If  LaMom > Loadin(5, N) / 2 Then  'when section is beyond End of udl 

    Mom = Mom - Loadin(3, N) * LaMom * Loadin(5, N)

    Else  'when section between CL load And End of udl 

    LaMom = (Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) + Loadin(4, N))) / 2

    Mom = Mom - Loadin(3, N) * LaMom ^ 2 * 2

    End If  

    Else 

    If  LaMom > -Loadin(5, N) / 2 Then  'when section is between CL load And start of udl 

    LaMom = (Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) + Loadin(4, N))) / 2

    Mom = Mom - Loadin(3, N) * LaMom ^ 2 * 2

    End If  

    End If  

    Else 

    Mom = Mom - Loadin(3, N) * LaMom * Loadin(5, N)

    End If  

    Case 4

    If  NoSpnLd = Loadin(1, N) Then 

    LaMom = (Sectn - (Lleft(NoSpnLd) - L(NoSpnLd))) / 3

    Mom = Mom - Loadin(3, N) * (3 * LaMom) ^ 2 / L(NoSpnLd) / 2 * LaMom

    Else 

    LaMom = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) / 3)

    Mom = Mom - Loadin(3, N) / 2 * LaMom * L(Loadin(1, N))

    End If  

    Case 5

  • 8/18/2019 Formula VBA vigas

    36/41

      If  NoSpnLd = Loadin(1, N) Then 

    LaMom = (Sectn - (Lleft(NoSpnLd) - L(NoSpnLd))) / 2

    Wi = (L(NoSpnLd) - 2 * LaMom) / L(NoSpnLd) * Loadin(3, N)

    Mom = Mom - Wi * 2 * LaMom ^ 2

    LaMom = (Sectn - (Lleft(NoSpnLd) - L(NoSpnLd))) / 3 * 2

    Mom = Mom - (Loadin(3, N) - Wi) * 1.5 * LaMom ^ 2 / 2

    Else 

    LaMom = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) / 3 * 2)

    Mom = Mom - Loadin(3, N) / 2 * LaMom * L(Loadin(1, N))End If  

    Case 6

    If  NoSpnLd = Loadin(1, N) Then 

    LdLen = Sectn - (Lleft(NoSpnLd) - L(NoSpnLd))

    If  LdLen > L(NoSpnLd) / 2 Then 

    LaMom = LdLen - L(NoSpnLd) / 3

    Mom = Mom - Loadin(3, N) * LaMom * L(NoSpnLd) / 2 / 2

    Wi = Loadin(3, N) * (L(NoSpnLd) - LdLen) / L(NoSpnLd)

    LaMom = (LdLen - L(NoSpnLd) / 2) / 2

    Mom = Mom - Wi * 2 * LaMom ^ 2

    Wi = Loadin(3, N) - WiLaMom = 4 * LaMom / 3

    Mom = Mom - Wi * LaMom ^ 2 * 1.5 / 2

    Else 

    LaMom = LdLen / 3

    Wi = LdLen / (L(NoSpnLd) / 2) * Loadin(3, N)

    Mom = Mom - Wi * LaMom * LdLen / 2

    End If  

    Else 

    LaMom = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) / 2)

    Mom = Mom - Loadin(3, N) / 2 * LaMom * L(Loadin(1, N))

    End If  

    End Select 

    Line5:

     Next N

    End Sub 

    Sub ShearAtSection()

    Dim LAshr As Double, Wi As Double, LdLen As Double 

    'NoSpnLd = Number of the Span that the Section is being considered

    'Calculate shears due To reactions

    Shr = 0

    For  N = 1 To NoSpnLd

    Shr = Shr - Rv(N) Next N

    'Calculate shears due To loads

    For  N = 1 To NoLoads

    If  Loadin(1, N) > NoSpnLd Then GoTo Line6

    Select Case Loadin(2, N)

    Case 1

    LAshr = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) + Loadin(4, N))

    If  LAshr > 0 Then 

    Shr = Shr + Loadin(3, N)

  • 8/18/2019 Formula VBA vigas

    37/41

      End If  

    Case 2

    LAshr = Sectn - Lleft(Loadin(1, N))

    If  LAshr > 0 Then 

    Shr = Shr + Loadin(3, N) * L(Loadin(1, N))

    Else 

    Shr = Shr + Loadin(3, N) * (L(Loadin(1, N)) + LAshr)

    End If  

    Case 3

    LAshr = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)) + Loadin(4, N))

    If  LAshr > 0 Then 

    If  LAshr > Loadin(5, N) Then 

    Shr = Shr + Loadin(3, N) * Loadin(5, N)

    Else 

    Shr = Shr + Loadin(3, N) * LAshr

    End If  

    End If  

    Case 4

    LAshr = Sectn - Lleft(Loadin(1, N))

    If  LAshr > 0 Then 

    Shr = Shr + Loadin(3, N) * L(Loadin(1, N)) / 2

    Else 

    LAshr = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)))

    Shr = Shr + Loadin(3, N) / L(Loadin(1, N)) * LAshr ^ 2 / 2

    End If  

    Case 5

    LAshr = Sectn - Lleft(Loadin(1, N))

    If  LAshr > 0 Then 

    Shr = Shr + Loadin(3, N) * L(Loadin(1, N)) / 2

    Else 

    LAshr = Sectn - (Lleft(Loadin(1, N)) - L(Loadin(1, N)))

    Wi = Loadin(3, N) / L(Loadin(1, N)) * LAshr

    Shr = Shr + (Loadin(3, N) - Wi / 2) * LAshr

    End If  

    Case 6

    If  NoSpnLd = Loadin(1, N) Then 

    LdLen = Sectn - (Lleft(NoSpnLd) - L(NoSpnLd))

    If  LdLen > L(NoSpnLd) / 2 Then LAshr = L(NoSpnLd) / 2

    Shr = Shr + Loadin(3, N) * LAshr / 2

    Wi = Loadin(3, N) * (LdLen - LAshr) / LAshr

    Shr = Shr + (Loadin(3, N) - Wi / 2) * (LdLen - LAshr)

    Else 

    Wi = LdLen / (L(NoSpnLd) / 2) * Loadin(3, N)

    Shr = Shr + Wi * LdLen / 2

    End If  

    Else 

    Shr = Shr + Loadin(3, N) / 2 * L(Loadin(1, N))

  • 8/18/2019 Formula VBA vigas

    38/41

      End If  

    End Select 

    Line6:

     Next N

    End Sub 

    Sub MOMatPoint()frmMomatPoint.cmdUp.Visible = False 

    frmMomatPoint.Show

    frmMomatPoint.txtDist.Value = ""

    frmMomatPoint.txtDist.SetFocus

    End Sub 

    Modulo 8

    Sub WriteNote()

    'Write Note on Notation

    Worksheets("Line Beam").Cells(LineC + 1, 1).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC + 1, 1).Value = "Notation: Reactions +ve upwards, Hogging Moments +ve"End Sub 

    Sub WriteReactn()

    'Calculate & Write Reactions

    Worksheets("Line Beam").Cells(LineC + 3, 1).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC + 3, 1).Value = "Reactions"

    Worksheets("Line Beam").Cells(LineC + 4, 2).HorizontalAlignment = xlRight

    Worksheets("Line Beam").Cells(LineC + 4, 2).Value = "Support No"

    Worksheets("Line Beam").Cells(LineC + 5, 2).HorizontalAlignment = xlRight

    Worksheets("Line Beam").Cells(LineC + 5, 2).Value = "Reaction"

    For  I = 1 To NoSpn + 1

    Worksheets("Line Beam").Cells(LineC + 4, 2 + I).NumberFormat = "0"

    Worksheets("Line Beam").Cells(LineC + 4, 2 + I).Value = I

    Worksheets("Line Beam").Cells(LineC + 5, 2 + I).NumberFormat = "0.000"

    If  Abs(Rv(I)) > 999 Then Worksheets("Line Beam").Cells(LineC + 5, 2 + I).NumberFormat = "0.00"

    If  Abs(Rv(I)) > 9999 Then Worksheets("Line Beam").Cells(LineC + 5, 2 + I).NumberFormat = "0.0"

    If  Abs(Rv(I)) > 99999 Then Worksheets("Line Beam").Cells(LineC + 5, 2 + I).NumberFormat = "0"

    Worksheets("Line Beam").Cells(LineC + 5, 2 + I).Value = Rv(I)

     Next I

    End Sub 

    Sub WriteMoms()

    'Calculate Moments

    For  J = 1 To NoSpn

    MomTable(1, J) = -FEM(J, 1)MomTable(11, J) = FEM(J, 2)

     NoSpnLd = J

    For  I = 1 To 9

    If  J = 1 Then 

    Sectn = I * L(1) / 10

    Else 

    Sectn = I * L(J) / 10 + Lleft(J - 1)

    End If  

    Call MomAtSection 'Module7 

  • 8/18/2019 Formula VBA vigas

    39/41

      MomTable(I + 1, J) = -Mom

     Next I

     Next J

    'Write Moments To LineBeam WorkSheet

    Worksheets("Line Beam").Cells(LineC + 7, 1).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC + 7, 1).Value = "Moments"

    For  I = 1 To NoSpn

    Worksheets("Line Beam").Cells(LineC + 7, 2 + I).Value = "Span " & I

     Next IWorksheets("Line Beam").Cells(LineC + 8, 2).Value = "0"

    For  I = 1 To 9

    Worksheets("Line Beam").Cells(LineC + 8 + I, 2).Value = "0." & I & "L"

     Next I

    Worksheets("Line Beam").Cells(LineC + 18, 2).Value = "L"

    For  J = 1 To NoSpn

    For  I = 1 To 11

    Worksheets("Line Beam").Cells(LineC + 7 + I, 2 + J).NumberFormat = "0.0000"

    If  Abs(MomTable(I, J)) > 99 Then Worksheets("Line Beam").Cells(LineC + 7 + I, 2 + J).NumberFormat = "0.000"

    If  Abs(MomTable(I, J)) > 999 Then Worksheets("Line Beam").Cells(LineC + 7 + I, 2 + J).NumberFormat = "0.00"

    If  Abs(MomTable(I, J)) > 9999 Then Worksheets("Line Beam").Cells(LineC + 7 + I, 2 + J).NumberFormat = "0.0"

    If  Abs(MomTable(I, J)) > 99999 Then Worksheets("Line Beam").Cells(LineC + 7 + I, 2 + J).NumberFormat = "0"Worksheets("Line Beam").Cells(LineC + 7 + I, 2 + J).Value = MomTable(I, J)

     Next I

     Next J

    End Sub 

    Sub WriteGraphMoms()

    'Write Moment values To graph data sheet

    Rowe = 4

    Worksheets("Graph Data").Cells(Rowe, 2).NumberFormat = "0.000"

    Worksheets("Graph Data").Cells(Rowe, 2) = 0

    Worksheets("Graph Data").Cells(Rowe, 3).NumberFor mat = "0.000"

    Worksheets("Graph Data").Cells(Rowe, 3) = MomTable(1, 1)

    Xgraph = 0

    For  J = 1 To NoSpn

    For  I = 2 To 11

    Rowe = Rowe + 1

    Xgraph = Xgraph + 0.1 * L(J)

    Worksheets("Graph Data").Cells(Rowe, 2).NumberFormat = "0.000"

    Worksheets("Graph Data").Cells(Rowe, 2) = Xgraph

    Worksheets("Graph Data").Cells(Rowe, 3).NumberFormat = "0.000"

    Worksheets("Graph Data").Cells(Rowe, 3) = MomTable(I, J)

     Next I

     Next J

    End Sub Sub WriteMaxMom()

    'Write Max inspan moments To End of Moment Table

    Worksheets("Line Beam").Cells(LineC + 19, 2).HorizontalAlignment = xlRight

    Worksheets("Line Beam").Cells(LineC + 19, 2).Value = "Max in-span Moment"

    Worksheets("Line Beam").Cells(LineC + 20, 2).HorizontalAlignment = xlRight

    Worksheets("Line Beam").Cells(LineC + 20, 2).Value = "Dist. from LH End"

    For  J = 1 To NoSpn

    If  ShearFlag(J) = 1 Then 

    Worksheets("Line Beam").Cells(LineC + 19, 2 + J).NumberFormat = "0.0000"

    If  Abs(MomMax(J, 1)) > 99 Then Worksheets("Line Beam").Cells(LineC + 19, 2 + J).NumberFormat = "0.000"

  • 8/18/2019 Formula VBA vigas

    40/41

      If  Abs(MomMax(J, 1)) > 999 Then Worksheets("Line Beam").Cells(LineC + 19, 2 + J).NumberFormat = "0.00"

    If  Abs(MomMax(J, 1)) > 9999 Then Worksheets("Line Beam").Cells(LineC + 19, 2 + J).NumberFor mat = "0.0"

    If  Abs(MomMax(J, 1)) > 99999 Then Worksheets("Line Beam").Cells(LineC + 19, 2 + J).NumberFormat = "0"

    Worksheets("Line Beam").Cells(LineC + 19, 2 + J).Value = MomMax(J, 1)

    Worksheets("Line Beam").Cells(LineC + 20, 2 + J).NumberFormat = "0.0000"

    If  Abs(MomMax(J, 2)) > 99 Then Worksheets("Line Beam").Cells(LineC + 20, 2 + J).NumberFormat = "0.000"

    If  Abs(MomMax(J, 2)) > 999 Then Worksheets("Line Beam").Cells(LineC + 20, 2 + J).NumberFormat = "0.00"

    If  Abs(MomMax(J, 2)) > 9999 Then Worksheets("Line Beam").Cells(LineC + 20, 2 + J).NumberFormat = "0.0"

    If  Abs(MomMax(J, 2)) > 99999 Then Worksheets("Line Beam").Cells(LineC + 20, 2 + J).NumberFormat = "0"Worksheets("Line Beam").Cells(LineC + 20, 2 + J).Value = MomMax(J, 2)

    Else 

    Worksheets("Line Beam").Cells(LineC + 19, 2 + J).NumberFormat = "@"

    Worksheets("Line Beam").Cells(LineC + 19, 2 + J).Value = "@ support"

    Worksheets("Line Beam").Cells(LineC + 20, 2 + J).NumberFormat = "@"

    Worksheets("Line Beam").Cells(LineC + 20, 2 + J).Value = "--"

    End If  

     Next J

    End Sub 

    Sub WriteShears()

    'Write Shears To LineBeam WorkSheetWorksheets("Line Beam").Cells(LineC + 22, 1).HorizontalAlignment = xlLeft

    Worksheets("Line Beam").Cells(LineC + 22, 1).Value = "Shears"

    For  I = 1 To NoSpn

    Worksheets("Line Beam").Cells(LineC + 22, 2 + I).Value = "Span " & I

     Next I

    Worksheets("Line Beam").Cells(LineC + 23, 2).Value = "0"

    For  I = 1 To 9

    Worksheets("Line Beam").Cells(LineC + 23 + I, 2).Value = "0." & I & "L"

     Next I

    Worksheets("Line Beam").Cells(LineC + 33, 2).Value = "L"

    For  J = 1 To NoSpn

    For  I = 1 To 11

    Worksheets("Line Beam").Cells(LineC + 22 + I, 2 + J).NumberFormat = "0.0000"

    If  Abs(ShearTable(I, J)) > 99 Then Worksheets("Line Beam").Cells(LineC + 22 + I, 2 + J).NumberFormat = "0.000"

    If  Abs(ShearTable(I, J)) > 999 Then Worksheets("Line Beam").Cells(LineC + 22 + I, 2 + J).NumberFormat = "0.00"

    If  Abs(ShearTable(I, J)) > 9999 Then Worksheets("Line Beam").Cells(LineC + 22 + I, 2 + J).NumberFormat = "0.0"

    If  Abs(ShearTable(I, J)) > 99999 Then Worksheets("Line Beam").Cells(LineC + 22 + I, 2 + J).NumberFormat = "0"

    Worksheets("Line Beam").Cells(LineC + 22 + I, 2 + J).Value = ShearTable(I, J)

     Next I

     Next J

    End Sub 

    Sub WriteGraphShears()

    'Write Shear values To graph tableWorksheets("Graph Data").Range("E4:F220") = ""

    For  I = 1 To Rowe

    If  I > 1 And ShearGraph(I, 1) 0 Then 

    Worksheets("Graph Data").Cells(I + 3, 5).NumberFormat = "0.000"

    Worksheets("Graph Data").Cells(I + 3, 5) = ShearGraph(I, 1)

    Worksheets("Graph Data").Cells(I + 3, 6).NumberFormat = "0.000"

    Worksheets("Graph Data").Cells(I + 3, 6) = ShearGraph(I, 2)

    End If  

     Next I

  • 8/18/2019 Formula VBA vigas

    41/41

    End Sub 

    Modulo 9

    Sub hideloadsSheet()

    DialogSheets("LoadType").Hide

    frmLoadin.ComLoadType.SetFocus

    End Sub