【问题标题】:User forms and dynamic look into table, is this possible?用户表单和动态查看表格,这可能吗?
【发布时间】:2020-12-23 06:07:26
【问题描述】:

用户表单和动态查表,可以吗?

我有一张动态变化的表格。我正在尝试制作一个进入该表的三个选项的用户表单。

我试图对我的目标进行 Photoshop 处理。

我只是不知道 VBA 是否可以动态查找 B2:B13,因为主题可以更改。

工作簿链接:https://drive.google.com/file/d/1ST3a9i3hKCWHDRnPb_167F2L547EisxT/view?usp=sharing

提前谢谢你!

【问题讨论】:

  • 你可以add controls to a userform on runtime dynamically:但我认为使用这样的用户表单比直接编辑表格没有任何优势(因为它显示完全相同的数据)。也许您可以使用隐藏 D 列并锁定工作表,但 C 列除外,用户应该能够在其中输入数据。考试结束后,只需让您的宏取消隐藏 D 列,您就可以输入分数。比用户表单容易得多。

标签: excel vba dynamic datatable


【解决方案1】:

我确信它可以完成,但看起来你真的过度设计了这个。为什么不将数据集转换为表格,表格的大小会随着数据元素的变化而动态增加和减少?

在 Excel 中创建表格

Open the Excel spreadsheet.
Use your mouse to select the cells that contain the information for the table. 
Click the "Insert" tab > Locate the "Tables" group.
Click "Table". A "Create Table" dialog box will open. 
If you have column headings, check the box "My table has headers".
Verify that the range is correct > Click [OK].
Resize your columns to make the headings visible.

另外,请参阅:

https://exceljet.net/excel-tables

或者,引用整个列/行,而不是特定范围,并使用诸如 INDEX/MATCH 之类的东西,或者你需要的任何东西。

【讨论】:

    猜你喜欢
    • 2018-04-14
    • 2013-08-20
    • 2023-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-09
    • 1970-01-01
    相关资源
    最近更新 更多