Public Function QSortInPlace( _ ByRef ReportArray As Variant, _ Optional ByVal LB As Long = -1&, _ Optional ByVal UB As Long = -1&, _ Optional ByVal Descending As Boolean = True, _ Optional ByVal NoAlerts As Boolean = False) As Boolean End Function
Private Sub cmdReport_Click() Dim sngPerc As Single 'used to calculate percentage being 100 over total save figure Dim strReport As String Dim ReportArray(1 To 5) As String Dim strError As String 'Divide by zero error check string Dim arrReportString As String 'Sorted array for output strReport = MsgBox("Would you like to create the total sales to date report?", vbYesNo, "Report") If strReport = vbYes Then If Range("C12").Value = 0 Then strError = MsgBox("Enter Values First", vbOKOnly) Else sngPerc = 100 / Range("C12").Value ReportArray(1) = Range("C7").Value * sngPerc & "% are Daisies" ReportArray(2) = Range("C8").Value * sngPerc & "% are Roses" ReportArray(3) = Range("C9").Value * sngPerc & "% are Basic Bouchets" ReportArray(4) = Range("C10").Value * sngPerc & "% are Betty's Beauties" ReportArray(5) = Range("C11").Value * sngPerc & "% are Fiona's Fantastics" QSortInPlace (ReportArray) frmReport.ltbReport.List() = ReportArray frmReport.Show End If End If End Sub