Hello guys,
I used code already existed and changed it for my needs but I have troubles with adding function for counting how many labels per each row will be printed with zebra printer.
Here below is picture of table (Table6) which I am using as data.
Label is on different sheet:
VBA Code is below:
Code is working fine for whole table but it prints just 1 label. It should follow Table6 Column named N.BOX.
I have tried with Range function but it works only for one row. I do not know how to include whole column.
It was like:
... but at the end I deleted it since it is not working properly.
Does anyone have solution how I can print whole list of labels by counting also N.BOX column in table?
Thanks in advance !
Djordje
I used code already existed and changed it for my needs but I have troubles with adding function for counting how many labels per each row will be printed with zebra printer.
Here below is picture of table (Table6) which I am using as data.
Label is on different sheet:
VBA Code is below:
PHP:
Sub Print_Labels()
Dim c As Range, Printer As Variant, Printers As Variant, cPrinter As String, AbortPrintIf MsgBox("Are you sure you want to print " & [Table6[ITEM]].Count & " Labels for " & Range("F1").Value & " Invoice?", vbQuestion + vbYesNo) = vbYes ThenApplication.ScreenUpdating = False cPrinter = ActivePrinter Printers = GetPrintersAndPorts For Each Printer In Printers If InStr(Printer, "MSP-Label2") Then Application.ActivePrinter = Printer: Exit For End If Next Printer If Not InStr(ActivePrinter, "MSP-Label2") Then If MsgBox("Specified Label printer not found!" & vbCrLf & "Do you want to print to " & ActivePrinter & " ?", vbExclamation + vbYesNo) <> vbYes Then GoTo AbortPrint End If End If For Each c In [Table6[N.BOX]] With Sheets("Label") .[E5] = Range("B2") .[E2] = Intersect(c.EntireRow, [Table6[ITEM]]) .[E3] = Intersect(c.EntireRow, [Table6[QTY/BOX]]) End With ThisWorkbook.Worksheets("Label").PrintOut NextAbortPrint: Application.ActivePrinter = cPrinter Application.ScreenUpdating = TrueEnd If
End Sub
I have tried with Range function but it works only for one row. I do not know how to include whole column.
It was like:
PHP:
For a = 1 to Range("D5").Value etc...
Does anyone have solution how I can print whole list of labels by counting also N.BOX column in table?
Thanks in advance !
Djordje