OaklandJim
Well-known Member
- Joined
- Nov 29, 2018
- Messages
- 855
- Office Version
- 365
- Platform
- Windows
I did research this but cannot figure it out.
I am trying to embed a picture into a cell. My problem is that I need to convert the picture's .Width to the .ColumnWidth for the cell into which the picture will be embedded, so the cell is wide enough. How do I do the conversion?
I have researched this but the best I could find is the following sub that converts a CELL's .Width to .ColumnWidth.
Source: What is the unit of Excel column width? - Simple Excel VBA
The logic works well to convert a CELL's .Width to .ColumnWidth. But I need to convert the PICTURE's .Width to .ColumnWidth for the cell into which the picture is embedded.
I hope that a math plus Excel wizard can tell me how to do this.
I am trying to embed a picture into a cell. My problem is that I need to convert the picture's .Width to the .ColumnWidth for the cell into which the picture will be embedded, so the cell is wide enough. How do I do the conversion?
I have researched this but the best I could find is the following sub that converts a CELL's .Width to .ColumnWidth.
Source: What is the unit of Excel column width? - Simple Excel VBA
VBA Code:
Sub f_width(rng As Range, i As Long)
Dim j As Long
With rng
For j = 1 To 3
.ColumnWidth = i / .Width * .ColumnWidth
Next j
End With
End Sub
The logic works well to convert a CELL's .Width to .ColumnWidth. But I need to convert the PICTURE's .Width to .ColumnWidth for the cell into which the picture is embedded.
I hope that a math plus Excel wizard can tell me how to do this.