option button dependant micro
I have pasted my final code below and it works BEAUTIFULLY! Thank you
very much for your help.
Private Sub cmdOK_Click()
'Dealer name
If optAsc.Value = True And optDealer.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
If optDes.Value = True And optDealer.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlDescending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
'Signature
If optAsc.Value = True And optSig.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
If optDes.Value = True And optSig.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlDescending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
'PO
If optAsc.Value = True And optPO.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
If optDes.Value = True And optPO.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("C2"), Order1:=xlDescending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
'Invoice
If optAsc.Value = True And optInv.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
If optDes.Value = True And optInv.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("D2"), Order1:=xlDescending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
'Date
If optAsc.Value = True And optDate.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("E2"), Order1:=xlAscending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
If optDes.Value = True And optDate.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("E2"), Order1:=xlDescending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
'Due Date
If optAsc.Value = True And optDue.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("F2"), Order1:=xlAscending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
If optDes.Value = True And optDue.Value = True Then
Range("Database").Select
Selection.Sort Key1:=Range("F2"), Order1:=xlDescending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
End Sub
|