Numbers with leading zeroes, using vb6

后端 未结 3 778
野性不改
野性不改 2020-12-19 07:52

How can I add leading zeroes to a number? For example:

Dim stracctnumber as String
stracctnumber = 987654321

If stracctnumber

相关标签:
3条回答
  • 2020-12-19 08:25

    B8 = Format((Format(B2, "###,###")), "@@@@@@@")

    This is to add spaces to left.

    WORKS GREAT in VBA Excel.....

    0 讨论(0)
  • 2020-12-19 08:29
    stracctnumber = Format(stracctnumber, String(15, "0"))
    
    0 讨论(0)
  • 2020-12-19 08:45
    strAcct = Right("000000000000000" & strAcct, 15)
    

    Note that concatenation is relatively 'expensive'. If this is just for display, rather than modifying the underlying value, consider using the Format() function.

    0 讨论(0)
提交回复
热议问题