Saberexcel - o site das macros
Macro ao Aplicativo Microsoft Excel VBA, arredonda comentarios nos cantos
Sub Adiciona_arredondando_comentario()
Application.ScreenUpdating = False
On Error GoTo ErrorSaber
With ActiveCell
.AddComment
.Comment.Visible = True
.Comment.Shape.AutoShapeType = msoShapeRoundedRectangle
.Comment.Shape.Select True
.Comment.Text Text:="Aprenda Microsoft Excel VBA com qualidade Saberexcel"
End With
With Selection
.Font.Size = 8
.ShapeRange.Shadow.Visible = msoFalse
.ShapeRange.ScaleWidth 1.2, msoFalse, msoScaleFromTopLeft
.ShapeRange.ScaleHeight 0.5, msoFalse, msoScaleFromTopLeft
.ShapeRange.Adjustments.Item(1) = 0.25
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
ErrorSaber:
Application.ScreenUpdating = True
End Sub
'Macro auxiliar usada nos testes com medidas diferentes e arredondados nos cantos
Sub Adiciona_arredondando_comentario_II()
Application.ScreenUpdating = False
On Error GoTo ErrorSaber
With ActiveCell
.AddComment
.Comment.Visible = True
.Comment.Shape.AutoShapeType = msoShapeRoundedRectangle
.Comment.Shape.Select True
.Comment.Text Text:="Aprenda Microsoft Excel VBA com qualidade Saberexcel"
End With
With Selection
.Font.Size = 11
.ShapeRange.Shadow.Visible = msoFalse
.ShapeRange.ScaleWidth 1.6, msoFalse, msoScaleFromTopLeft
.ShapeRange.ScaleHeight 1.3, msoFalse, msoScaleFromTopLeft
.ShapeRange.Adjustments.Item(1) = 4.25
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
ErrorSaber:
Application.ScreenUpdating = True
End Sub
Macro auxiliar para os testes dos alunos desenvolvedores
Sub deleta_todos_teste()
Dim resposta As String
resposta = MsgBox("Deseja deletar todos os comentarios para teste?", vbYesNo + vbCritical, _
"Saberexcel - Site das Macros")
If resposta = 6 Then '=sim
For Each sb In ActiveSheet.Comments
sb.Delete
Next
End If
End Sub
Aprenda tudo sobre o Aplicativo Microsoft Excel VBA(Visual Basic Application), sozinho, com baixo custo, praticando com os produtos didáticos Saberexcel
Baixe o exemplo de planilha das macros acima:
Excel planilha vba comentario macro insere comentarios arredondados (19.94 kB )