Hello,
In order to print invoices based on the result of a dropdown list, I am using the following code:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
<o
> </o
>
Sub Print_Invoice()
Dim rCell As Range
With ActiveSheet <o
></o
>
ForEach rCell In .Range("A2:A10")
.Range("J3").Value = rCell.Value: Calculate
If .Range("P14").Value > 0 Then .PrintOut
Next rCell
EndWith
EndSub
On my invoice form appears the name of the deliverer in cell H3. I am trying to refine the code above to print out invoices in the ALPHABETICAL order of the H3 cell content. <o
></o
>
<o
> </o
>
I found in that forum the code below to sort the printing order but since I am a VBA novice, I have no idea what to do with that code… Can you help?
<o
></o
>
Private Sub VSortMA(ary, LB, UB, ref)
Dim M As Variant, i As Long, ii As Long, iii As Long
i = UB: ii = LB
M = ary(Int((LB + UB) / 2), ref)
Do While ii <= i
Do While ary(ii, ref) < M
ii = ii + 1
Loop
Do While ary(i, ref) > M
i = i - 1
Loop
If ii <= i Then
For iii = LBound(ary, 2) To UBound(ary, 2)
temp = ary(ii, iii): ary(ii, iii) = ary(i, iii): ary(i, iii) = temp
Next
ii = ii + 1: i = i - 1
End If
Loop
If LB < i Then VSortMA ary, LB, i, ref
If ii < UB Then VSortMA ary, ii, UB, ref
End Sub <o
></o
>
<o
> </o
>
<?xml:namespace prefix = st1 /><st1
lace></st1
lace><st1
lace></st1
lace><st1
lace></st1
lace><!-- / message -->
In order to print invoices based on the result of a dropdown list, I am using the following code:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
<o
Sub Print_Invoice()
Dim rCell As Range
With ActiveSheet <o
ForEach rCell In .Range("A2:A10")
.Range("J3").Value = rCell.Value: Calculate
If .Range("P14").Value > 0 Then .PrintOut
Next rCell
EndWith
EndSub
On my invoice form appears the name of the deliverer in cell H3. I am trying to refine the code above to print out invoices in the ALPHABETICAL order of the H3 cell content. <o
<o
I found in that forum the code below to sort the printing order but since I am a VBA novice, I have no idea what to do with that code… Can you help?
<o
Private Sub VSortMA(ary, LB, UB, ref)
Dim M As Variant, i As Long, ii As Long, iii As Long
i = UB: ii = LB
M = ary(Int((LB + UB) / 2), ref)
Do While ii <= i
Do While ary(ii, ref) < M
ii = ii + 1
Loop
Do While ary(i, ref) > M
i = i - 1
Loop
If ii <= i Then
For iii = LBound(ary, 2) To UBound(ary, 2)
temp = ary(ii, iii): ary(ii, iii) = ary(i, iii): ary(i, iii) = temp
Next
ii = ii + 1: i = i - 1
End If
Loop
If LB < i Then VSortMA ary, LB, i, ref
If ii < UB Then VSortMA ary, ii, UB, ref
End Sub <o
<o
<?xml:namespace prefix = st1 /><st1