0

I am using VBA in Excel for Microsoft 365.

I wish to obtain the default column width and store it in a Double variable. This is driven by the desire to not hardcode it. I have attempted to obtain this value as follows:

Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count))

Dim columnStandardWidth As Double
columnStandardWidth = ws.StandardWidth

However, this returns a value of 8.11 rather than the expected 8.43.

I have two questions:

  1. How may I obtain the proper value of 8.43?
  2. What does the column width of 8.11 represent?
4
  • 1
    Is it possible in your debugging that you set the default size to 8.11 for that workbook? Does the same code provide 8.11 for a brand new workbook?
    – squillman
    Commented Jan 23 at 12:46
  • 1
    Your code shows 8.43 for my default workbook. Have you checked the actual width of the columns in your new worksheet?
    – Paul
    Commented Jan 23 at 13:08
  • @squillman, I did not explicitly change the default size to be 8.11. However, to my surprise... It is 8.11 (under "Home-->Format-->Default Width..."). This is true for my current workbook as well as for a brand new workbook. This is true both in the Excel GUI (as just mentioned) and in the VBA code I showed above. I cannot explain this. For years, I've known the default width to be 8.43, and it now appears to be 8.11.
    – Dave
    Commented Jan 24 at 11:32
  • @Paul, the actual width of new columns in both my current and new worksheets is 8.11. I would have expected 8.43 as you are seeing.
    – Dave
    Commented Jan 24 at 11:34

1 Answer 1

2

According to Microsoft, the default column width is 8.43. However this can can change based on your default font size as mentioned here and is 8.11:

The default column width has to do with default font size, and 8.11 of a standard character fit in the column.

In my case, the default column width is like yours 8.11.

How may I obtain the proper value of 8.43?

Create a new template and customize it as described here:

To create a new default Excel workbook template:

  1. Open a new blank Excel workbook.
  2. Next, customize the blank workbook exactly as you want it to look.
  3. Save the workbook with the specific file name in a designated folder.

On step 2, set the default width to 8.43.

2
  • I have created a template named book.xltx as described in the article you linked. I tried placing it in both directories listed in the article. I also tried placing it in the directory that auto-populated in the "Save As" dialog box when I selected a file type of .xltx. (That directory was C\Users\<user name>\Documents\Custom Office Templates.) In none of these three cases was I able to then create a new workbook whose default column width was 8.43. The default column width remained at 8.11.
    – Dave
    Commented Jan 24 at 11:59
  • @Dave This is how I did/do it: After opening a new workbook, CTRL+A to select the whole sheet, then Home -> Format -> Default Width : 8.43. I save the file as Excel template. Close excel or the file. Launch Excel, then open the template. When I check the width it's 8.44. Commented Jan 24 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .