数字字符串累加问题
以下字符串代表起始卡号与终止卡号047238888900010607-047238888900010617,现在用split函数取的起始卡号,用format函数保证字符串格式不为科学计数法,
Format(Split(rstemp.Fields(29), "-")(0), "000000000000000000"),现在想从起始卡号每次加1,一直加到终止卡号,如何实现
[解决办法]
dim xx as long
for xx=900010607 to 900010617
xx=xx+1
debug.print "047238888" & format(xx,"000000000")
next
[解决办法]
Dim xStart_H As Long
Dim xStart_L As Long
Dim xEnd_H As Long
Dim xEnd_L As Long
xStart_H = CLng(Left("047238887900010607", 9))
xStart_L = CLng(Right("047238887900010607", 9))
xEnd_H = CLng(Left("047238888900010617", 9))
xEnd_L = CLng(Right("047238888900010617", 9))
Dim xx As Long
Dim yy As Long
xx = xStart_L
yy = xStart_H
Do While Not (yy = xEnd_H And xx = xEnd_L)
xx = xx + 1
If xx = 1000000000 Then
xx = 0
yy = yy + 1
End If
Debug.Print Format(yy, "000000000") & Format(xx, "000000000")
Loop