Adicionado em: | 08/03/2011 |
Modificado em: | 08/03/2011 |
Tamanho: | Vazio |
Downloads: | 349 |
O Site das Macros excel vba
Essa macro do Aplicativo Microsoft Excel VBA (Visual Basic Application) , insere o contéudo do comentário na célula, onde esta o comentário.
Option Explicit
Sub Salvar_comentario_na_celula()
Dim vCelula As Excel.Range
Dim vComentario As String
Dim vContador As Integer
With Sheets("Plan1")
On Error Resume Next
For Each vCelula In .UsedRange.Cells
vComentario = ""
vComentario = vCelula.Comment.Text
If vComentario <> "" Then
vContador = InStr(vComentario, ":")
If vContador > 0 Then
vComentario = Right(vComentario, Len(vComentario) - vContador - 1)
End If
vCelula = vComentario
End If
Next
On Error GoTo 0
End With
End Sub
Sub limpar_teste()
[H6,G17].Value = ""
End Sub
Aprenda tudo sobre o Aplicativo Microsoft Excel VBA (Visual Basic Application), sozinho, com baixo custo,
praticando com os produtos didáticos SaberExcel
Adicionado em: | 19/11/2010 |
Modificado em: | 19/11/2010 |
Tamanho: | Vazio |
Downloads: | 413 |
Saberexcel - o site das macros
Caro E_Marcondes, sou programador e preciso de uma macro, que insere um triângulo azul no lugar do indicador(vermelho) do comentário,
eu tinha mas acabei perdendo, se você tiver, será que poderia me enviar, obrigado. Reginaldo
Sim tenho sim, junto à minha coleção de 15.000 macros achei, na verdade é uma macro servida de uma função:
Cor do triângulo do indicador do comentário em azul
'Option Explicit
Sub Criar_triangulo_indicador_comentario()
vCriarIndicador vbBlue, "EPM"
End Sub
Public Function vCriarIndicador(CommentIndicatorColor As Long, _
CommentIndicatorName As String) As Boolean
'
Dim IDnumber As Long
Dim aCell As Range
Dim aComment As Comment
Dim aShape As Shape
Dim aWorksheet As Worksheet
Dim aWorkbook As Workbook
vCriarIndicador = False
If CommentIndicatorName = vbNullString Then GoTo ExitFunction
On Error GoTo ExitFunction
Set aWorkbook = ActiveWorkbook
IDnumber = 0
'loop through all wprksheets in the active workbook and all comments
'in each worksheet and create the comment shapes
For Each aWorksheet In aWorkbook.Worksheets
For Each aShape In aWorksheet.Shapes
If Left(aShape.Name, Len(CommentIndicatorName)) = _
CommentIndicatorName Then
aShape.Delete
End If
Next aShape
For Each aComment In aWorksheet.Comments
Set aCell = aComment.Parent
If InStr(1, aComment.Shape.TextFrame.Characters.Text, ":") > 0 Then
If Left(aComment.Shape.TextFrame.Characters.Text, InStr(1, aComment.Shape.TextFrame.Characters.Text, ":") - 1) = Application.UserName Then
GoSub CreateCommentIndicator
End If
End If
Next aComment
Next aWorksheet
vCriarIndicador = True
ExitFunction:
On Error GoTo 0
Set aCell = Nothing
Set aComment = Nothing
Set aShape = Nothing
Set aWorksheet = Nothing
Set aWorkbook = Nothing
Exit Function
CreateCommentIndicator:
Set aShape = aWorksheet.Shapes.AddShape(Type:=msoShapeRightTriangle, _
Left:=aCell.Left + aCell.Width - 5, _
Top:=aCell.Top, _
Width:=5, _
Height:=5)
IDnumber = IDnumber + 1
With aShape
.Name = CommentIndicatorName & CStr(IDnumber)
.IncrementRotation -180#
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = CommentIndicatorColor
.Line.Visible = msoTrue
.Line.Weight = 1
.Line.Style = msoLineSingle
.Line.DashStyle = msoLineSolid
.Line.ForeColor.RGB = CommentIndicatorColor
.Placement = xlMove
End With
Return
End Function
Aprenda Microsoft Excel VBA (( Saberexcel ))
Adicionado em: | 19/11/2010 |
Modificado em: | 19/11/2010 |
Tamanho: | Vazio |
Downloads: | 440 |
Saberexcel - site das macros Microsoft Excel VBA
Essa macros do Aplicativo Microsoft Excel VBA, mostram e ou ocultam todos os comentários existentes na folha de planilha
Sub mostrar_todos_comentarios()
On Error Resume Next
saber1.Shapes("sb1").Visible = True
saber1.Shapes("sb").Visible = False
Dim sb As Comment
For Each sb In ActiveSheet.Comments
sb.Visible = True
Next sb
End Sub
'Essa macro do Aplicativo Microsoft Excel VBA oculta todos os comentários existentes na planilha
Sub ocultar_todos_comentarios()
On Error Resume Next
saber1.Shapes("sb1").Visible = False
saber1.Shapes("sb").Visible = True
Dim sb As Comment
For Each sb In ActiveSheet.Comments
sb.Visible = False
Next sb
End Sub
Aprenda Microsoft Excel VBA(Visual Basic Application) com qualidade SaberExcel
Adicionado em: | 19/11/2010 |
Modificado em: | 19/11/2010 |
Tamanho: | Vazio |
Downloads: | 471 |
Saberexcel - dicas de macros microsoft excel vba
Essa macro do aplicativo Microsoft Excel VBA adiciona um um texto a um comentario a partir da célula ativa.
Sub adicionando_comentario_com_texto()
On Error Resume Next
ActiveCell.AddComment
ActiveCell.Comment.Text Text:=ActiveCell.Text
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
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