Create comments in cells whose value is larger than the column width
It can sometimes be helpfull having a large cell value in a comment. You can then easily read the value (hover over cell) instead of resizing column widths.
The following subroutine adds a comment to cells where the value exceeds the column width.
Sub Createcomments()
'Create comments in cells where the value is larger than column width
Dim rng As Range
Dim Cell As Variant
On Error Resume Next
Set rng = Application.InputBox(Prompt:="Select a range:", _
Title:="Create comments in cells where the value is larger than column width", _
Default:=Selection.Address, Type:=8)
On Error GoTo 0
If rng Is Nothing Then
Else
For Each Cell In rng
If Len(Cell) * 0.9 > Cell.ColumnWidth Then
If Cell.Comment Is Nothing Then
Cell.AddComment Cell.Value
End If
End If
Next Cell
End If
End Sub
Download excel *.xlsm file
add comments.xlsm
Related posts:
Create unique distinct list from column where an adjacent column meets criteria
Filter a column and create a new unique list sorted from A to Z using array formula in excel
Create a unique distinct alphabetically sorted list, extracted from a column in excel

















