Created
November 30, 2016 06:42
-
-
Save alezhu/1a1540c992ecfa51c565015884ac497e to your computer and use it in GitHub Desktop.
Excel ColumnWidth for merged cells too
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function GetCellWidth(ra As range) As Double | |
Dim vColWidth As Double | |
Dim cell As range | |
vColWidth = ra.ColumnWidth | |
If ra.MergeCells Then | |
vColWidth = 0 | |
For Each cell In ra.MergeArea.Cells | |
vColWidth = vColWidth + cell.ColumnWidth | |
Next | |
End If | |
GetCellWidth = vColWidth | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment