Randomize()
Dim a(16) As Integer
For i = 0 To 15
a(i) = Rnd () * 16777215 '16777215 is the value converted from FFFFFF to decimal. VB's randomization is to give a decimal number from 0 to 1. You can multiply it by the range you need
MsgBox(Strings.Right(" 00000" & Hex(a(i)), 6)) 'hex() converts decimal to hexadecimal. After conversion, I add the string "00000" in front, and then take the first 6 from right to left Bit
Next