简体   繁体   中英

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...

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).

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

"Columnwidth" isn't in point, "Width" is in points.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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