I'm using an excel file to generate a list of UPC codes to send to a printer.
The UPC code needs to be 12 digits.
In the source excel file the UPC codes are stored as text with a leading zero.
Using the code below, they are populating the new list as numbers without the leading zero.
Formatting as a 12 digit number does not work because the printer does not read the leading zero.
It needs to be stored as text.
What am I doing wrong?
Source sheet examples (number is stored as text with the little green corner in the cell and the warning sign)
[TABLE="width: 500"]
<tbody>[TR]
[TD]ColumnA[/TD]
[TD]ColumnB[/TD]
[TD]ColumnC[/TD]
[TD]ColumnD[/TD]
[TD]ColumnE[/TD]
[TD]UPC[/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]B2[/TD]
[TD]C2[/TD]
[TD]D3[/TD]
[TD]E4[/TD]
[TD]097963547574[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD]B3[/TD]
[TD]C3[/TD]
[TD]D3[/TD]
[TD]E3[/TD]
[TD]097963664127[/TD]
[/TR]
</tbody>[/TABLE]
Current Output
[TABLE="width: 500"]
<tbody>[TR]
[TD]ColumnA[/TD]
[TD]ColumnB[/TD]
[TD]UPC[/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]B2[/TD]
[TD]97963547574[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD]B3[/TD]
[TD]97963664127[/TD]
[/TR]
</tbody>[/TABLE]
The UPC code needs to be 12 digits.
In the source excel file the UPC codes are stored as text with a leading zero.
Using the code below, they are populating the new list as numbers without the leading zero.
Formatting as a 12 digit number does not work because the printer does not read the leading zero.
It needs to be stored as text.
What am I doing wrong?
Source sheet examples (number is stored as text with the little green corner in the cell and the warning sign)
[TABLE="width: 500"]
<tbody>[TR]
[TD]ColumnA[/TD]
[TD]ColumnB[/TD]
[TD]ColumnC[/TD]
[TD]ColumnD[/TD]
[TD]ColumnE[/TD]
[TD]UPC[/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]B2[/TD]
[TD]C2[/TD]
[TD]D3[/TD]
[TD]E4[/TD]
[TD]097963547574[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD]B3[/TD]
[TD]C3[/TD]
[TD]D3[/TD]
[TD]E3[/TD]
[TD]097963664127[/TD]
[/TR]
</tbody>[/TABLE]
Current Output
[TABLE="width: 500"]
<tbody>[TR]
[TD]ColumnA[/TD]
[TD]ColumnB[/TD]
[TD]UPC[/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]B2[/TD]
[TD]97963547574[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD]B3[/TD]
[TD]97963664127[/TD]
[/TR]
</tbody>[/TABLE]
Code:
Dim UPC_code As String
UPC_code = sourceWS.Cells(iRow, 6).Text
expandWS.Cells(printRow, 3).Value = UPC_code