Hi there,

I have an excel sheet which contains CustomerPartNumber, MPN, CustomerPO,TotalReel,Company,Location,....as header.

I need to print all the records which contain CustomerPartNumber, MPN, CustomerPO,TotalReel,Company data using barcode printer.
I have succeessfully done this part.

The problem is the header excel sheets that i receiving is not in a fix cell position. For example, the first excel i have MPN in second column, but the next excel maybe will in 5th column. Is there any way i can capture the data by their header?

One more,if the excel only start on row no 10 with its header and data, can it be written in VB6 to specify that row10 is header so that i can use sql syntax to capture the data? The reason it starts at 10th row because the front row need to leave some space for the customer name and details.

Any reply is greatly appreciated. Thanks.

Best regards,

I would do this:

for int iRow = 1 to 100
    for int iCustomerPartNumberCol = 1 to 100
        'Examine cell to see if it contains "CustomerPartNumber"
    next iCustomerPartNumberCol
next iRow

Once you find a matching cell for "CustomerPartNumber", you have found the row your headings are at and also the column for your part number. Now you can search the other columns for the other headings in a similar manner.