Vertical Analysis
Private Sub CommandButton1_Click()
Dim i As Integer
i = 4
Do Until Cells(i, 3) = ""
If Cells(i, 3).Value = "" Then
ElseIf Cells(i, 3).Value <> "" Then
Cells(i, 3).EntireRow.Insert
Cells(i, 3).Activate
r = ActiveCell.Offset(-1, 0).Rows.Value
ActiveCell.Value = r / Range("G2").Value
ActiveCell.NumberFormat = "0%"
ActiveCell.HorizontalAlignment = xlRight
ActiveCell.Font.Italic = True
ActiveCell.Offset(0, 1).Select
With Selection
q = ActiveCell.Offset(-1, 0).Rows.Value
ActiveCell.Value = q / Range("H2").Value
ActiveCell.NumberFormat = "0%"
ActiveCell.HorizontalAlignment = xlRight
ActiveCell.Font.Italic = True
ActiveCell.Offset(0, -2).Select
ActiveCell.Value = ActiveCell.Offset(-1, 0).Value & " % in Assets"
ActiveCell.Font.Italic = True
End With
End If
i = i + 2
Loop
Columns("B").AutoFit
End Sub