-
Knowledge Base Approver
The King of Overkill!
VBAX Master
Hi Glen,
I changed it to suit your needs, what I did was create an array for you to put the PCIDs in after printing, so you can make sure you don't print the same one twice. I also included a different way of assigning the PCIDcol variable, so it dynamically chooses the range instead of hardcoding like you did (with A19:A28). Please don't hesitate to ask if you have any questions![vba]Sub ports18()
Dim App_List As Worksheet, Build_Sheet As Worksheet
Dim PCIDcol As Range, CellToPasteTo As Range, CLL As Range
Dim UsedPCIDs() As String, Cnt As Long, i As Long, aPCID As String
'***** CHANGE AS NEEDED *****
Set App_List = Sheets("App_List")
Set Build_Sheet = Sheets("Build_Sheet")
Set CellToPasteTo = Build_Sheet.Range("H3")
Set PCIDcol = App_List.Range("A19:A28")
'uncomment the next line to set pcidcol with used cells starting with A19
'Set PCIDcol = App_List.Range("A19", App_List.Range("A65536").End(xlUp))
ReDim UsedPCIDs(0)
Cnt = 0
Set PCIDcol = Intersect(PCIDcol, App_List.UsedRange) ', App_List.Rows("2:65536"))
For Each CLL In PCIDcol.Cells
aPCID = CLL.Value
For i = 0 To Cnt - 1
If UsedPCIDs(i) = aPCID Then Exit For
Next
If i = Cnt Then
ReDim Preserve UsedPCIDs(Cnt)
UsedPCIDs(Cnt) = aPCID
Cnt = Cnt + 1
CellToPasteTo.Value = aPCID
Build_Sheet.PrintOut
End If
Next
End Sub[/vba]Matt
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules