PDA

View Full Version : Want to fill data from Excel in to specific Form for Print Lable.



anandthak
11-30-2017, 12:15 PM
I have data in excel i want to fill those particular data automatically into specific form for label print. 2 label in to A4 Page.
Order File Data want to fill in to Envelope format.

Many Many Thanks in Advance.

offthelip
11-30-2017, 04:36 PM
I had a look at your two workbooks and it is not at all clear what you want: there doesn't seem to be any correlation between the headers in the Order file and any of the items in the Envelop format_final. Moving the data would be very easy if I knew what data needed to be copied from where to where.

offthelip
11-30-2017, 05:18 PM
Here is a generic macro to move data around as you specify. I have used another worksheet called " Config" to define where each item will go on the "envelope sheet"

Remarks ID ORDER DATE SHIP DATE
I22 I9 J7 I21


etc for all columns

Sub copydata()
With Worksheets("Config")
Mapping = Range(.Cells(2, 1), .Cells(2, 40))
End With
With Worksheets("ORDER")
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
inarr = Range(.Cells(1, 1), .Cells(lastrow, 40))
End With
Worksheets("Envelope").Select

For i = 2 To lastrow
For k = 1 To 30
Rangestr = Mapping(1, k) & ":" & Mapping(1, k)
Range(Rangestr) = inarr(i, k)
Next k
' post the envelope here, I am not sure what you want done at this point


Next i


End Sub