Adicionado em: | 19/11/2010 |
Modificado em: | 19/11/2010 |
Tamanho: | Vazio |
Downloads: | 513 |
Saberexcel - o site das macros
Esta macro do aplicativo Microsoft Excel VBA, formatam o tamanho da fonte
dos comentarios em uma determinada folha de planilha
Sub Tamanho_fonte_comentario()
On Error Resume Next
Dim sbComentario As Comment
For Each sbComentario In ActiveSheet.Comments
sbComentario.Shape.TextFrame.Characters.Font.Size = 9
Next
End Sub
'Esta macro também formata o tamanho da fonte dos comentarios, porém, age
'como uma auxiliar para testes.
Sub Tamanho_fonte_comentario()
On Error Resume Next
Dim sbComentario As Comment
For Each sbComentario In ActiveSheet.Comments
sbComentario.Shape.TextFrame.Characters.Font.Size = 18
Next
End Sub
Aprenda Microsoft Excel VBA com qualidade Saberexcel
sozinho em casa, com baixo custo
Compre com segurança numa das maiores lojas do pais, tem de tudo a bons preços.
Adicionado em: | 19/11/2010 |
Modificado em: | 19/11/2010 |
Tamanho: | Vazio |
Downloads: | 594 |
Saberexcel - o site das macros
Formatando a fonte do comentário em negrito as quatro primeiras letras
Essa macro adiciona e formata as primeira 4 letras em negrito de um comentário
Macro formata de acordo com o números de letras desejado, observe a linha de código Selection.Characters(1, 4).
Esta macro formata o comentário as 4 primeiras letras, formata a fonte em negrito e se na célula já um houver comentário mostra um erro, manda selecionar outra célula.
Sub comentario_4_primeira_letra_Negrito()
On Error GoTo sbError
If Not ExisteCommentaire Then
ActiveCell.AddComment
End If
ActiveCell.Comment.Visible = True
ActiveCell.Comment.Text Text:="Saberexcel - Comentário para teste!"
ActiveCell.Comment.Shape.Select
Selection.Characters(1, 4).Font.FontStyle = "Bold"
ActiveCell.Comment.Visible = False
Exit Sub
sbError: MsgBox ("Comentário Existente!, selecione outra célula!"): Exit Sub
End Sub
Aprenda Microsoft Excel VBA (Saberexcel)
em casa, sozinho, a custo muito baixo. (esforço e vontade)
Adicionado em: | 19/11/2010 |
Modificado em: | 19/11/2010 |
Tamanho: | Vazio |
Downloads: | 560 |
Macro formata o nome do autor do comentário em vermelho
Saberexcel - o site das macros
Esta macro do Aplicativo Microsoft Excel VBA, mostrar nome do autor no comentário formatado em vermelho.
Sub adicionando_comentario_Titulo_autor_vermelho()
Dim TB As TextBox
With ActiveCell
If Not .Comment Is Nothing Then .Comment.Delete
With .AddComment("XL-Eves®" & vbLf & "Jesus é o Caminho a Verdade e a Luz")
Set TB = .Shape.OLEFormat.Object
With TB.Characters(1, 7).Font
.Bold = True
.Color = vbRed
End With
End With
End With
End Sub
Aprenda Microsoft Excel VBA com Sabaerexcel
Em casa, sozinho, com baixo custo.
Adicionado em: | 19/11/2010 |
Modificado em: | 19/11/2010 |
Tamanho: | Vazio |
Downloads: | 734 |
Saberexcel - site das macros
Anota no comentário as vezes que a célula foi acessada e os dados modificados
Essa macro do Aplicativo Microsoft Excel VBA, anota todas vezes que acessar a célula(E5) e fazer alguma modificação, mostrando a palavra inserida, hora e data do acesso. Observe que usei o Evento Worksheet_Change (No módulo de código da planilha)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 5 Then Exit Sub
If Target.Row <> 5 Then Exit Sub
Dim ccc As String
ccc = Format(Date + Time, "mm/dd/yy hh:mm") _
& " " & Target.Value ' -- Application.UserName
If Target.Comment Is Nothing Then
Target.AddComment.Text ccc
Else
Target.Comment.Text (Target.Comment.Text & Chr(10) & ccc)
End If
Target.Comment.Shape.TextFrame.AutoSize = True
End Sub
Aprenda Microsoft Excel VBA (Saberexcel)
Adicionado em: | 19/11/2010 |
Modificado em: | 19/11/2010 |
Tamanho: | Vazio |
Downloads: | 485 |
Saberexcel - o site das macros
Macros do Aplicativo Microsoft Excel VBA, insere shapes númerados nos comentários.
Sub inserir_shapes_numerados()
Dim Wsh As Worksheet
Dim cmt As Comment
Dim lCmt As Long
Dim rngCmt As Range
Dim shpCmt As Shape
Dim shpW As Double 'shape width
Dim shpH As Double 'shape height
Set Wsh = ActiveSheet
shpW = 8
shpH = 6
lCmt = 1
For Each cmt In Wsh.Comments
Set rngCmt = cmt.Parent
With rngCmt
Set shpCmt = Wsh.Shapes.AddShape(msoShapeRectangle, _
rngCmt.Offset(0, 1).Left - shpW, .Top, shpW, shpH)
End With
With shpCmt
With .Fill
.ForeColor.SchemeColor = 2 'white
.Visible = msoTrue
.Solid
End With
With .Line
.Visible = msoTrue
.ForeColor.SchemeColor = 64 'automatic
.Weight = 0.25
End With
With .TextFrame
.Characters.Text = lCmt
.Characters.Font.Size = 4
.MarginLeft = 0#
.MarginRight = 0#
.MarginTop = 0#
.MarginBottom = 0#
.HorizontalAlignment = xlCenter
End With
.Top = .Top + 0.001
End With
lCmt = lCmt + 1
Next cmt
End Sub
Esta macro remove os indicadores(shapes) inseridos nos comentários
Sub Remove_indicador_shapes()
Dim Wsh As Worksheet
Dim shp As Shape
Set Wsh = ActiveSheet
For Each shp In Wsh.Shapes
If Not shp.TopLeftCell.Comment Is Nothing Then
If shp.AutoShapeType = _
msoShapeRectangle Then
shp.Delete
End If
End If
Next shp
End Sub
Esta macro relaciona os comentários em uma folha de planilha separada, numero, nome, valor, e endereço do comentário
Sub Relacionar_comentarios()
Application.ScreenUpdating = False
Dim commrange As Range
Dim cmt As Comment
Dim Atual_Plan As Worksheet
Dim nova_plan As Worksheet
Dim i As Long
Set Atual_Plan = ActiveSheet
On Error Resume Next
Set commrange = Atual_Plan.Cells _
.SpecialCells(xlCellTypeComments)
On Error GoTo 0
If commrange Is Nothing Then
MsgBox "nao foi encontrado comentários"
Exit Sub
End If
Set nova_plan = Worksheets.Add
nova_plan.Range("A1:D1").Value = _
Array("Numero", "Nome", "Valor", "Comentário")
i = 1
For Each cmt In Atual_Plan.Comments
With nova_plan
i = i + 1
On Error Resume Next
.Cells(i, 1).Value = i - 1
.Cells(i, 2).Value = cmt.Parent.Name.Name
.Cells(i, 3).Value = cmt.Parent.Value
.Cells(i, 4).Value = cmt.Parent.Address
.Cells(i, 5).Value = Replace(cmt.Text, Chr(10), " ")
End With
Next cmt
nova_plan.Cells.WrapText = False
nova_plan.Columns.AutoFit
Application.ScreenUpdating = True
End Sub
Adquira já o Acesso Imediato
à Area de Membros
Aprenda Excel VBA com Simplicidade de
códigos e Eficácia, Escrevendo Menos e
Fazendo Mais.
'-------------------------------------'
Entrega Imediata:
+ 500 Video Aulas MS Excel VBA
+ 35.000 Planilhas Excel e VBA
+ Coleção 25.000 Macros MS Excel VBA
+ 141 Planilhas Instruções Loops
+ 341 Planilhas WorksheetFunctions(VBA)
+ 04 Módulos Como Fazer Excel VBA
+ Curso Completo MS Excel VBA
+ Planilhas Inteligentes
<script type="text/javascript"><!--
google_ad_client = "ca-pub-2317234650173689";
/* retangulo 336 x 280 */
google_ad_slot = "0315083363";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Aprenda tudo sobre o Aplicativo Microsoft Excel VBA(Visual Basic Application), sozinho, com baixo custo, praticando com os produtos didáticos Saberexcel,
Sobre as WorksheetFunctions Funções de Planilhas que retornam valores do VBA