在Array - VBA中存储和打印值

时间:2014-08-15 15:24:13

标签: arrays vba excel-vba excel

我刚刚开始使用VBA,所以我对此并不了解。我用VBA进行了蒙特卡罗模拟(只是一个用于计算公式的for循环),现在我想从for循环中获取每个值,并在excel工作表中将它们打印在彼此之下。

我考虑过在数组中将for循环后的每个值存储起来并将其打印出来,但我确实陷入了困境。数组是最好的方法还是更简单?

我的代码是这样的:

for i = 1 to numberofclients
for j = 1 to numberofsimulations
   -->my formula to compute the value I want to print
Next j
---> It would be ideal that after every set of simulations the value could be printed under each other
Next i

非常感谢你们!如果您需要真正的来源我可以随时粘贴它。

1 个答案:

答案 0 :(得分:0)

在VB编辑器的立即窗口中显示信息(Ctrl + G)...

Debug.Print *some value here*