0% found this document useful (0 votes)
5 views1 page

Grasp

The document contains a VBA script that populates a worksheet with node and member forces, formatting the results accordingly. It also includes a subroutine to ensure that all required worksheets exist, deleting any unnecessary ones and adding missing sheets. The script is designed to manage data organization within an Excel workbook for structural analysis.

Uploaded by

Le Fondateur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Grasp

The document contains a VBA script that populates a worksheet with node and member forces, formatting the results accordingly. It also includes a subroutine to ensure that all required worksheets exist, deleting any unnecessary ones and adding missing sheets. The script is designed to manage data organization within an Excel workbook for structural analysis.

Uploaded by

Le Fondateur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ws.Cells(row, 5).Value = U((node.

NodeID - 1) * 6 + 4) ' Rx
ws.Cells(row, 6).Value = U((node.NodeID - 1) * 6 + 5) ' Ry
ws.Cells(row, 7).Value = U((node.NodeID - 1) * 6 + 6) ' Rz
row = row + 1
Next node

' Output member forces


row = 2
Dim mem As clsMember
For Each mem In MemberList
ws.Cells(row, 9).Value = mem.MemberID
ws.Cells(row, 10).Value = mem.AxialForce
ws.Cells(row, 11).Value = mem.ShearForceY
ws.Cells(row, 12).Value = mem.ShearForceZ
ws.Cells(row, 13).Value = mem.MomentY
ws.Cells(row, 14).Value = mem.MomentZ
ws.Cells(row, 15).Value = mem.Torsion
row = row + 1
Next mem

' Format results


ws.Columns("B:G").NumberFormat = "0.000E+00"
ws.Columns("J:O").NumberFormat = "0.000"
End Sub

Private Sub SetupDataSheets()


' Ensure all required worksheets exist
Dim ws As Worksheet
Dim sheetNames As Variant
Dim i As Integer

sheetNames = Array("Data", "Materials", "Sections", "Load Cases",


"Results", "Structure Plot", "Design Checks")

' Delete existing sheets (except the first one which must exist)
Application.DisplayAlerts = False
For i = 1 To ThisWorkbook.Worksheets.Count
If i > UBound(sheetNames) + 1 Then
ThisWorkbook.Worksheets(i).Delete
End If
Next i

' Add missing sheets


For i = 0 To UBound(sheetNames)
On Error Resume Next
Set ws = ThisWorkbook.Worksheets(sheetNames(i))
On Error GoTo 0

If ws Is Nothing Then
Set ws =
ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Worksheets(ThisWorkbook.Works
heets.Count))
ws.Name = sheetNames(i)
End If
Next i
Application.DisplayAlerts = True

P a g e 26 | 57

You might also like