Planilha Excel VBA Shapes 23 shapes posicionar imagens
Este Macro do Aplicativo Microsoft Excel VBA(Visual Basic Application), vamos aprender como movimentar, mudar e deletar um ou todos os shapes autoformas que estiverem dentro de determinada célula.
RES: movimentar shapes de uma célula para outra ou deletar se estiver em determinada célula na folha de planilha excel
Sub sbx_posicionar_shapes()
‘observe que shapes(1) é a ordem que foi inserida na folha de planilha
ActiveSheet.Shapes(1).Top = [D9].Top
ActiveSheet.Shapes(1).Left = [D9].Left
MsgBox “Mudar [” & ActiveSheet.Shapes(1).Name & “] para Celula D9”, vbInformation, “Escola Saberexcel VBA Estudos®”
End Sub
Sub sbx_mudar_posicionamento_shapes_teste()
‘observe que shapes(1) é a ordem que foi inserida na folha de planilha
ActiveSheet.Shapes(1).Top = [N9].Top
ActiveSheet.Shapes(1).Left = [N9].Left
MsgBox “Mudar [” & ActiveSheet.Shapes(1).Name & “] para Celula N9”, vbInformation, “Escola Saberexcel VBA Estudos®”
End Sub
Sub sbx_voltar_posicionamento_B2()
‘observe que shapes(1) é a ordem que foi inserida na folha de planilha
ActiveSheet.Shapes(1).Top = [b2].Top
ActiveSheet.Shapes(1).Left = [b2].Left
MsgBox “Voltar com [” & ActiveSheet.Shapes(1).Name & “] para Celula B2”, vbInformation, “Escola Saberexcel VBA Estudos®”
End Sub
Sub sbx_deletar_shapes_posicao_d15()
For Each s In ActiveSheet.Shapes
If s.TopLeftCell.Address = “$D$9” Then
resp = MsgBox(“Deseja deletar de vez o Presidente[” & ActiveSheet.Shapes(1).Name & ” ]”, vbYesNo, “Escola Saberexcel VBA Estudos”)
If resp = 6 Then
s.Delete
MsgBox “Presidente Deletado!”
Else
MsgBox “Presidente ” & ActiveSheet.Shapes(1).Name & ” permanece!”, vbInformation, “Escola Saberexcel VBA Estudos®”
End If
End If
Next s
End Sub

Aprenda tudo sobre planilhas do Aplicativo Microsoft Excel VBA(Visual Basic Application), sozinho, com baixo custo, praticando com os produtos didáticos Escola SaberExcel VBA Estudos® – Treinamentos com Macros, Fórmulas e Funções.
Compre pelo PagSeguro | Compre pelo PayPal | |
![]() |
![]() |
|
Material Didático: Curso Excel VBA Expert |
![]() |
![]() |
![]() |
Excel VBA Shapes Planilha 23 shapes posicionar imagens