问题描述
隐藏的列在哪里存储其columnwidth值?
Where is a hidden column storing its columnwidth value?
我已经发现 testRange1.ColumnWidth = 0
与 testRange2.EntireColumn.Hidden = True
相同.分组也很相似:
I've already found out that testRange1.ColumnWidth = 0
is the same as testRange2.EntireColumn.Hidden = True
.And grouping is similar too:
testRange3.Columns.Group
ActiveWorksheet.Outline.ShowLevels columnlevels:=1
在所有三种情况下的结果都是:
The result in all three cases is:
debug.Print testRange1.ColumnWidth
0
debug.Print testRange2.ColumnWidth
0
debug.Print testRange3.ColumnWidth
0
取消隐藏列或扩展组将恢复原始的 ColumnWidth
(非常沮丧).
Unhiding the columns or expanding the group restores the original ColumnWidth
(Much to my dismay).
但是现在我真的很好奇那些隐藏的列存储将被还原到的宽度的位置.将宽度设置为明显的值,然后隐藏该列,然后在调试窗口中搜索属性,我在任何地方都找不到它.
But now i'm really curious as to where those hidden columns store the width to which they will be restored.Setting the width to something obvious bevore hiding the column and then searching through the properties in the debug window, i couldn't find it anywhere.
推荐答案
您可以使用范围的 .previous.width
属性,因此
You could use the .previous.width
properties of the range, so
set r = range("a1")调试.?r.previous.width
会表演.
这篇关于隐藏列的列宽属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!