29 June 2019

Excel VBA : Search and Change Comments Box Using VBA

Assalamualaikum,

Jadi malam ni aku buat VBA untuk search and tukar comments box.

Enjoy
Zaiem



Sub changecommentbox2()


Dim rng As Range, cell As Range
Set rng = Range("D6:IW42")

For Each cell In rng
    cell.Select
    'Selection.ShapeRange.AutoShapeType = msoShapeRectangle
    If Selection.Comment Is Nothing Then
        'MsgBox "Has no comment"
    Else
        'MsgBox "There is comment in box"
        'Selection.Comment.Text "Ladida"
        
        
        Selection.Comment.Shape.Select True
        Selection.ShapeRange.AutoShapeType = msoShapeRectangle
        
    End If

Next cell

End Sub