Advice please on how to manage mixed data from a table

Jat999

New Member
Joined
May 7, 2016
Messages
49
Hi

I am struggling a bit on what and how to specifically manage variable data type from a table to a cell which is going to be bar code symbology.

To explain futher - I have coming from an ERP system, a batch code. The batch code can be alpha-numeric, plain numeric and sometimes with leading zeros. The code, amongst other data comes into a table in Excel. At this point, the data reads correctly.
However for the user, they only see the batch code and certain other information in a user form, as here I am reading the table into the user form as an array, and again it displays correctly.
The issue comes, when I then populate an Excel sheet with the value of the batch code. If it is alpha-numeric its fine, however if it has a leading zero, then this gets stripped. 0316 becomes 316 as an example.
Now I have to be careful that I do not introduce hidden charachters as the code is also converted to barcode symbology.

My current line of code that takes the batch reads as
ws.range("Batch_Code") = GRPOArray(tblPick,3) 'GRPO is the array, tblPick is a variable determined by how many rows are in the array and the 3 is the offset. "Batch_Code" is the named cell range in the spreadsheet.

Thanks in advance for any ideas please

John
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
John

Formatting the destination cell as Text should preserve any leading zeros without adding any other characters.
VBA Code:
With ws.Range("Batch_Code")
    .NumberFormat = "@
    .Value = GRPOArray(tblPick, 3)
End With
 
Upvote 0
Solution

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top