Hi, bobbysue25,
both codes go into a standard module:
Function myList(sh As String, lngCol As Long)
Dim vntList(), n As Long, vntC, vntTmp
Dim myCol As New Collection
With Sheets(sh)
ReDim vntList(1 To .Cells(Rows.Count, lngCol).End(xlUp).Row)
vntTmp = .Range(.Cells(10, lngCol), .Cells(Rows.Count, lngCol).End(xlUp))
End With
For Each vntC In vntTmp
Err.Clear
On Error Resume Next
myCol.Add vntC, CStr(vntC)
If Err.Number = 0 Then
n = n + 1
vntList(n) = vntC
End If
Next
ReDim Preserve vntList(1 To n)
myList = vntList
End Function
Sub Printing()
'
' Printing Macro
'
Dim lngLR As Long
Dim varList As Variant
'
varList = myList(ActiveSheet.Name, 1)
With ActiveSheet
For lngLR = LBound(varList) To UBound(varList)
.Range("A9").CurrentRegion.AutoFilter Field:=1, Criteria1:=varList(lngLR)
.PrintOut Copies:=1
Next lngLR
End With
End Sub
The Function will create a list of all unique items in Column A and then loop through the Collection in order to print. There must be no check as only those items being listed are printed.
Ciao,
Holger
Bookmarks