Column Width in centimetres instead of pixels?

  • Thread starter Thread starter Stevie
  • Start date Start date
S

Stevie

I just want to know if it's possible to get the width of a column
displayed in centimetres instead of in Pixels.
It would be very useful since I want to make some labels with a
specific length in centimetres.

If it isn't possible, just let me know so I can look for another
solution.

Thanks in advance.

P.s.: I'm working with Excel 2000 in a win nt 4.0 environment.
 
Steven

Any object that is measured in inches or centimeters.....Text Box, Drawing
Object, List Box from the Forms Toolbar for instance or Comment Box size,
would be determined by the measurment system set in your Windows Regional
Settings.

Row heights are measured in points. There are 72 points to an inch.

The number that appears in the Standard column width box is the average number
of digits 0-9 of the standard font that fit in a cell.

No relationship between the two.

If you want to use VBA to set height and width in mm....which you could
convert to inches.

Ole Erlandson has code for setting row and column dimensions.

http://www.erlandsendata.no/english/index.php?d=envbawssetrowcol

Gord Dibben Excel MVP
 
Thanks for the help.
The only problem that's left is that I got the part for the row height
is the one I got to work, but the code pasted below, that should dot
the thing for the column width won't get to work.

Sub SetColumnWidthMM(ColNo As Long, mmWidth As Integer)
' changes the column width to mmWidth
Dim w As Single
If ColNo < 1 Or ColNo > 255 Then Exit Sub
Application.ScreenUpdating = False
w = Application.CentimetersToPoints(mmWidth / 10)
While Columns(ColNo + 1).Left - Columns(ColNo).Left - 0.1 > w
Columns(ColNo).ColumnWidth = Columns(ColNo).ColumnWidth - 0.1
Wend
While Columns(ColNo + 1).Left - Columns(ColNo).Left + 0.1 < w
Columns(ColNo).ColumnWidth = Columns(ColNo).ColumnWidth + 0.1
Wend
End Sub

Where am I missing something?

Thanks in advance for your help.
 
Steven

Works for me if I call it from another Sub which has the arguments.

Sub Change_Col_Width()
SetColumnWidthMM 4, 55
'sets column4(D) to 55mm
End Sub

If you got the RowHeightMM to work, you must have done similar.

Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top