在阵列中存储和打印值-VBA [英] Storing and Printing values in Array - VBA
问题描述
我刚开始使用VBA,所以我对此并不了解。我已经使用VBA进行了蒙特卡洛模拟(只是一个用于计算公式的for循环),现在我想从该for循环中获取每个值,并将其在excel工作表中相互打印。
I am just starting out with VBA, so I don't know a lot about it. I've made an Monte Carlo Simulation with VBA (just a for-loop to compute a formula) and now I want to get every value from that for-loop and print it out under each other in the excel worksheet.
我考虑过将for循环之后的每个值存储在数组中并打印出来,但是我确实陷入了这一过程。数组是执行此操作的最佳方法还是可以更容易完成?
I thought about storing every value after the for-loop in an array and printing it out, but I got really stuck in the process. Is an array the best method for this or can it be done easier?
我的代码是这样的:
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
非常感谢你们!如果需要真正的资源,我可以随时将其粘贴在这里。
Thank you very much guys! If you need the real source I can always paste it here.
推荐答案
在VB编辑器的即时窗口中显示信息( Ctrl + G)...
To show information in the Immediate window in the VB editor (Ctrl+G)...
Debug.Print *此处有一些值*
这篇关于在阵列中存储和打印值-VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!