I take it this order form is a Word document with a single table? In which
case you can create a merge data source from that form, with which you can
create a label merge
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm . The following
macro will do that for however many columns you have.
Sub LabelData()
Dim oSource As Document
Dim oTarget As Document
Dim oTable As Table, oData As Table
Dim oRow As Row, oNewRow As Row
Dim oCell As Cell
Dim oRng As Range, oName As Range, oProduct As Range
Dim i As Long, j As Long
Set oSource = ActiveDocument
Set oTable = oSource.Tables(1)
Set oTarget = Documents.Add
Set oData = oTarget.Range.Tables.Add(oTarget.Range, 1, 2)
oData.Cell(1, 1).Range.Text = "Customer"
oData.Cell(1, 2).Range.Text = "Product"
For Each oRow In oTable.Rows
If oRow.Index 1 Then
For Each oCell In oRow.Range.Cells
If Len(oCell.Range) 2 Then
Set oRng = oCell.Range
oRng.End = oRng.End - 1
i = Val(oRng.Text)
j = oCell.ColumnIndex
Set oName = oRow.Cells(1).Range
oName.End = oName.End - 1
Set oProduct = oTable.Cell(1, j).Range
oProduct.End = oProduct.End - 1
For k = 1 To i
Set oNewRow = oData.Rows.Add
oNewRow.Cells(1).Range.Text = oName.Text
oNewRow.Cells(2).Range.Text = oProduct.Text
Next k
End If
Next oCell
End If
Next oRow
End Sub
--
Graham Mayor - Word MVP
My web site
www.gmayor.com
Word MVP web site
http://word.mvps.org
"TThunder" wrote in message
...
I'm using Office 2003 --
I have an order form with the purchaser's name in column A and products to
be ordered in columns B-Z. Most cells are empty, but if someone orders a
product, the number of items ordered for each product is in the
corresponding
cell.
Example:
Customer Jelly Jam Peanuts
John Doe 2 1
Jane Doe 3 1
I would like to print labels with the customer's name and product, and
print
as many labels as there are products ordered, for example, 2 labels for
John
Doe/Jelly, 1 label for John Doe/Jam, 3 labels for Jane Doe/Jam, 1 label
for
Jane Doe/Peanuts, etc.
How can I do this? Thanks -- T.