更改数据验证下拉菜单的宽度 [英] Change width of data validation dropdown
问题描述
在我的工作簿中,单元格AR8:AS8被合并,并且在单元格中是一个数据验证下拉列表.列表的来源使用公式= indirect(GG8),它引用了其他选项卡中的列表.
In my workbook, cells AR8:AS8 are merged and in the cell is a data validation dropdown list. The source of the list uses the formula =indirect(GG8) and this refers to lists in a different tab.
我的问题是,当我单击下拉列表时,该框的宽度不足以显示完整的项目.
My problem is that when I click on the dropdown, the box isn't wide enough to show the full item.
有什么办法可以改变这个?如果可能的话,我宁愿不使用VBA.
Is there any way of changing this? I would prefer to NOT use VBA if possible..
期待您的回复:)
推荐答案
没有实现此W/O VBA的方法.如果您想使用VBA解决方案,请在下面找到代码.您必须将此代码粘贴到您的工作表模块
中,而不是 Regular模块
中,然后根据注释进行调整.
There is no possible way to achieve this W/O VBA. if you wish to use VBA solution, then please find code below. You have to paste this code to your Worksheet module
, not Regular module
, and adjust based on comments.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Target.Address = "$H$1" Then 'adjust this range to your drop down list
Target.Columns.ColumnWidth = 30 'adjust to your needs
Else
Columns(8).ColumnWidth = 8 'adjust column number to column with drop down values
End If
End Sub
未选择下拉菜单时:
选择下拉菜单
这篇关于更改数据验证下拉菜单的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!