我正在尝试将数字复制并粘贴到列中(该数字将在整个“ A”列中变化),并且我需要在该列中填充一个单元格的实例数等于该单元格中另一个单元格的值数据集。该值在整个过程中也会有所不同。任何帮助,将不胜感激。如果值为3751022,而另一栏中的值为11
The image shows the set Im working on. It need to copy down 3751022 down column A 1-11 times because the first entry will already be done. once the 10 are pasted then it needs to wait for the next entry to past another value down x amount of time
答案 0 :(得分:0)
我不完全了解您将在哪里获得想要的价值 重复一遍,但是您可以构建类似
的函数
Public Function Copy2()
Dim r1, r2, r3 As Range
Dim ct
Set r1 = Range("a1") 'set pointer
Set r2 = Range("b1") 'set pointer
Set r3 = Range("c1") 'set pointer
Do ' outer loop going through each number in column A until it comes up to a blank cell
ct = 0
Do ' Inner loop printing the # of times a number is requested from coresponding colum B data
ct = ct + 1
' prints column 3 info
r3.Value = r1.Value
Set r3 = r3.Offset(1, 0)
Loop Until ct = r2.Value
Set r2 = r2.Offset(1, 0)
Set r1 = r1.Offset(1, 0)
Loop Until r1.Value = ""
End Function
然后,您可以从按钮中调用它,并在其中分配代码,例如
Private Sub CommandButton2_Click()
Copy2
End Sub
这将在A列下移,并开始使用在其各自的B列中发现的出现次数填充新的C列