Bloubul, you have specifically asked for a vb script to use on an Excel sheet. I'm wondering why you havent asked for formulas to do the same job? The golden rule is never use a script when Excels functions can do it anyway. This is a classic example of using VLOOKUP to get the vtracs for each digit.
You do not specify where your data is, nor do you specify whether it is a 3 digit number in each single cell, or whether each of the three digits is in 3 separate cells ???
Well here is a lesson on how to do it yourself, you can do this on a new blank sheet first to learn it. If you need it on an existing sheet, it is easily portable once you know what is going on.
I do not do vtracs and in the UK we dont have your type of pick 3 game, so I had to read
v-tracs for dummies to get the vtracs for pick 3.
Assuming your pick 3 number is 3 digits in a SINGLE cell..
1. on a blank spreadsheet ...create a 2 column vtrac table ( 0 to 9) in cells I3:j12
I3 has zero in it, I4 has 1 in it, I5 has 2 in it ............>>> down to I12 has 9 in it. The second column V3:V12 has 1,2,3,4,5,1,2,3,4,5 respectively in each cell, so j3 has a 1 in it, ....>....>.... J12 has a 5 in it.
2. Select the table and whilst selected Type a name in the NAME BOX top left corner, name it vtracTable press <enter>. ( or you can use the Name Manager to do the same thing).
3. enter any 3 digit number 0 to 999 in cell A3
(splitting the digits into 3 cells and converting...)
first digit
4. in cell B3 enter the formula =VLOOKUP(INT(A3/100),vtracTable,2,1) press enter. this gives your first vtrac digit.
second digit
5. In cell C3 enter the formula =VLOOKUP(INT(MOD(A3,100)/10),vtracTable,2,1) press enter. this gives your second vtrac digit.
third digit
6. In cell D3 enter the formula =VLOOKUP(MOD(A3,10),vtracTable,2,1)
You now have the 3 digit vtrac for your first number in cells B3 to D3.
Combining the vtracs into a single cell
7. In cell F3 enter the formula =B3*100+C3*10+D3
you now have your first vtrac as a 3 digit number in a single cell.
8. if you want to be slick and avoid splitting the digits as in 4,5,6 above you can bypass that and go direct to the the 3 digit vtrac in a single cell.
e.g in cell G3 enter the formula =100*VLOOKUP(INT(A3/100),vtracTable,2,1)+10*VLOOKUP(INT(MOD(A3,100)/10),vtracTable,2,1)+VLOOKUP(MOD(A3,10),vtracTable,2,1). You now do not need the values in B3 to D3.
If you copy formulas B3:G3 down the spreadsheet, then 3 digit numbers entered in column A will be converted to vtracs .
OR If your original 3 digit result numbers were separated into 3 cells A25,B25,C25
e.g
and you want a 3 digit conversion ,with the answer in a single cell, then in cell F25 enter the formula =VLOOKUP(A25,vtracTable,2,1)*100+VLOOKUP(B25,vtracTable,2,1)*10+VLOOKUP(C25,vtracTable,2,1)
Again you can copy this fromula down the sheet.
Note the vtrac loookup table can be anywhere you like once it has been named.
As usual this took a lot longer to describe than it takes to actually do it! Have a go - its more versatile than a macro, which needs to know where everything is, how much there is, where you want to put it etc. etc.