简体   繁体   English

Excel VBA-以英寸为单位计算列宽

[英]Excel VBA - Calculate column width in inches

I am trying to determine the width of a column in inches. 我正在尝试确定以英寸为单位的列的宽度。 This formula sets the width to 5 inches but I cannot see how wide in inches column C is... 这个公式将宽度设置为5英寸,但我看不到C列的英寸宽...

Columns("D:D").ColumnWidth = Application.InchesToPoints(5) * (Columns("D:D").ColumnWidth / Columns("D:D").Width)

Any help is appreciated. 任何帮助表示赞赏。

Divide the column width by Application.InchesToPoints(1) (which is basically 72). 将列宽除以Application.InchesToPoints(1)(基本上是72)。

MsgBox Columns("C").Width / Application.InchesToPoints(1)

"Columnwidth" isn't in point, "Width" is in points. “ Columnwidth”不是以磅为单位,“ Width”是以磅为单位。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM