I am copying the format of one worksheet to another and setting the column widths the same. This line
returns 82
The cell is about an inch wide. This line sets the column about five inches wide
I am guessing that points are getting confused with pixels.
Complicating factor: The first row has the first cell merged out to column J. I added code to check for merge = true and when true, call a function that steps down in rows until the cell is no longer merged. That function still returns width of 82. It is here:
(Yes, the above for loop should be 2 to last_row but I set it to 1 just to see that the If would not exit on the first row. It did not.)
What am I missing?
Code:
column_width = original_ws.Cells(width_row, column).Width
The cell is about an inch wide. This line sets the column about five inches wide
Code:
new_ws.Columns(column).ColumnWidth = column_width
Complicating factor: The first row has the first cell merged out to column J. I added code to check for merge = true and when true, call a function that steps down in rows until the cell is no longer merged. That function still returns width of 82. It is here:
Code:
Function Find_First_Not_Merged_Row(this_sheet As Worksheet, last_row As Long, column As Long) As Long
Dim test_range As Range
Dim row As Long
With this_sheet
For row = 1 To last_row
Set test_range = .Range(.Cells(row, column), .Cells(row, column))
If (test_range.MergeCells = False) Then
Exit For
End If
Next row
Find_First_Not_Merged_Row = row
End With
End Function
(Yes, the above for loop should be 2 to last_row but I set it to 1 just to see that the If would not exit on the first row. It did not.)
What am I missing?
Last edited: