Blog Archive

About Me

A minha foto
JRod - PORTUGAL
Microsoft [MVP] - Excel (10º ano consecutivo)
Ver o meu perfil completo
Com tecnologia do Blogger.

Seguidores

Estatisticas

Free Blog Counter

eXTReMe Tracker
2005-02-19
Para inserir o mesmo Comentário em várias células de um determinado Range:





Pode utilizar-se (adaptado ao/aos Ranges pretendidos) o seguinte Código:

Private Sub Worksheet_Change(ByVal Target As Range)

' Macro para criar um Comentário numa célula

Dim rng1 As Range
Dim MyComment
Dim Cell As Range
MyComment = "Comentário:" & Chr(10) & "Isto é um Teste!"

Set rng1 = Intersect(Range("a1:a5"), Target)

    
    If Not rng1 Is Nothing Then

        For Each Cell In rng1.Cells
           Cell.ClearComments
           Cell.AddComment
           Cell.Comment.Visible = False
           Cell.Comment.Text Text:=MyComment
        Next
    Else
        Cancel = True
    End If

End Sub



NOTA: o Código deve ser colocado na própria folha - tecla direita do rato no tabulador da folha e escolher "Ver Código".