We have a barcode that we are scanning into an input screen, the barcode always has from 2 to 5 leading zeros followed by non zero numbers. I need to strip out the leading non zero numbers from the string.
We have been using the following Excel formula to the same process for a text string in a worksheet and it works great to find the string position for the first non leading zero and then we use mid to extract the trailing number.
=Find(Mid(Substitute(A1,0,""),2,1),A1)-1
Would love some help on VBA code, or, functions that can accomplish the same thing in macro. I tried the following (was just showing the position in a MSGBOX for testing purposes) but there is no Substitute function in VBA.
Dim ITM_NUM As Variant
Dim NUM_POS As Integer
ITM_NUM = InputBox("Scan Item Number")
NUM_POS = Find(Mid(Substitute(ITM_NUM, 0, ""), 2, 1), ITM_NUM) - 1
MsgBox NUM_POS
Thanks
Bookmarks