VBA - 字符串列表中的随机单元格填充 [英] VBA - Random Cell Filler from String List
问题描述
我已经做了很多搜索,但我没有提出我更喜欢的解决方案。也许没有一个......
这里有。
我有一个excel工作簿用于评估。在此工作簿中,用户查看控件并将2个不同的单元格更改为基于下拉列表的值。
例如
控制已实施? [已实施,部分实施,未实施]
差距? [是,否]
在仪表板上有一些图表可根据控件上的选项提供摘要和分数。
我想做的是允许用户通过创建一个vba宏来演示这个工作簿,该宏将填充整个文档的空白并用示例数据实现字段。 />
所以伪代码:
I have done quite a bit of searching but I am not coming up with the solution I prefer. Maybe there isn''t one...
Here goes.
I have an excel workbook that is used for assessments. In this workbook users look at controls and change 2 different cells to a value based off of a drop down list.
E.g.
Control Implemented? [Implemented, Partially Implemented, Not Implemented]
Gap? [Yes, No]
On a dashboard there are charts that give summaries and scores based off of the selections on the controls.
What I would like to do is allow a user to demo this workbook by creating a vba macro that would fill the whole document''s gap and implemented fields with example data.
So pseudo code:
推荐答案
- 为了澄清,你想要 Control Implemented?的3个随机值中的1个和 Gap的2个随机值中的1个?
- 这些值存在于2个组合框中?
- 摘要和Sc从这两个值自动生成矿石?
- Just for clarification, you want 1 of 3 Random Values for Control Implemented? and 1 of 2 Random Values for Gap?
- These Values exist in 2 Combo Boxes?
- Summaries and Scores are automatically generated from these 2 Values?
嘿ADezii,希望一切顺利。
是的。
#1完美
#2正确,它们在列表框中(从定义的范围拉出)以允许用户选择
#3正确将这些值转换为不同表格中的数字并用于生成分数
所以说的是,我希望将数据随机化以获得样本风险评分。这样我就可以在不添加16页数据的情况下显示该功能。
Hey ADezii, Hope all has been well.
Yes.
#1 perfect
#2 correct, they are in list box''s (pulled from a defined range) to allow the user to select from
#3 correct these values are converted to numbers in a different table and used to generate a score
So all that being said, I am looking to randomize the data to get a sample risk score. That way I can show the capability without adding 16 sheets of data.
- 这是我想出的希望它接近你正在寻找的东西,或者至少指出你正确的方向。
- 我创建了一个名为SelectRandoms()的宏,其快捷键为CTRL + SHIFT + R.
- 在这个宏中:
- Here is what I have come up with, hopefully it is close to what you are looking for or at least point you in the right direction.
- I created a Macro named SelectRandoms() with a Shortcut Key of CTRL+SHIFT+R.
- Within this Macro:
- 我创建了2个数组,一个用于保存控制实施的3个值?另一个用于保持2个Gap值?
- 生成0到2之间的随机数,并将其用作保存控制实现值的数组的索引。
- 随机数生成0到1之间的值,并将其用作保存Gap值的数组的索引。
- 然后将这些随机数组元素返回到名为MAIN的工作表上各自的单元格。
这篇关于VBA - 字符串列表中的随机单元格填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!