Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub Main()
'loads a new sheet with a table of values for
'PlanID, Participant count & Computed asset balance
Dim lRow As Long, wsSource As Worksheet, wsTable As Worksheet, lRowOut As Long, a
Set wsSource = ActiveSheet
Set wsTable = Worksheets.Add
With wsTable
.Cells(1, 1).Value = "PlanID"
.Cells(1, 2).Value = "Participant count"
.Cells(1, 3).Value = "Computed asset balance"
End With
With wsSource
lRowOut = 2
For lRow = 1 To LastCell(wsSource).Row
Select Case Trim(Left(.Cells(lRow, 1).Value, 8))
Case "Plan ID:"
a = Split(.Cells(lRow, 1).Value, " ")
wsTable.Cells(lRowOut, 1).Value = a(2)
Case "Particip"
wsTable.Cells(lRowOut, 2).Value = .Cells(lRow, "G").Value
Case "Computed"
If .Cells(lRow, 1).Value = "Computed asset balance:" Then
wsTable.Cells(lRowOut, 3).Value = .Cells(lRow, "F").Value
lRowOut = lRowOut + 1
End If
End Select
Next
End With
End Sub
Function LastCell(ws As Worksheet) As Range
With ws.Cells
Set LastCell = .Find("*", , , , xlByRows, xlPrevious)
End With
End Function
Sub Main()
'loads a new sheet with a table of values for
'PlanID, Participant count & Computed asset balance
Dim lRow As Long, wsSource As Worksheet, wsTable As Worksheet, lRowOut As Long, a
Set wsSource = ActiveSheet
Set wsTable = Worksheets.Add
With wsTable
.Cells(1, 1).Value = "PlanID"
.Cells(1, 2).Value = "Participant count"
.Cells(1, 3).Value = "Computed asset balance"
.Cells(1, 4).Value = "Computed fee"
End With
With wsSource
lRowOut = 2
For lRow = 1 To LastCell(wsSource).Row
Select Case Trim(Left(.Cells(lRow, 1).Value, 8))
Case "Plan ID:"
a = Split(.Cells(lRow, 1).Value, " ")
wsTable.Cells(lRowOut, 1).Value = a(2)
Case "Particip"
wsTable.Cells(lRowOut, 2).Value = .Cells(lRow, "G").Value
Case "Computed"
Select Case Trim(.Cells(lRow, 1).Value)
Case "Computed asset balance:"
wsTable.Cells(lRowOut, 3).Value = .Cells(lRow, "F").Value
Case "Computed fee:"
wsTable.Cells(lRowOut, 4).Value = .Cells(lRow, "F").Value
lRowOut = lRowOut + 1
End Select
End Select
Next
End With
End Sub