产生连续数 [英] Generating consecutive numbers
本文介绍了产生连续数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在一个列中获取连续的数字,在另一列中获取一个数字.
例如:单元格A1被赋予42,那么我想获得1,2,3,4 .... 42的数字应该在列B1:B42中生成.
How can I get consecutive numbers in one column giving a number in another column.
eg: Cell A1is given 42, then i want to get 1,2,3,4....42 numbers should generate in column B1:B42.
推荐答案
Dim i As Integer, j As Integer
Dim wsh as Worksheet
Set wsh = ThisWorkbook.Worksheets("Sheet1")
j = wsh.Range("A1")
For i = 1 to j
wsh.Range("B" & j) = j
Next
Set wsh = Nothing
这篇关于产生连续数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文