Planilha Excel VBA shapes 5 associar um nome a uma foto
Este procedimento do Aplicativo Microsoft Excel VBA(Visual Basic Application), Evento SelectionChange da folha de planilha faz uma associação uma imagem(Foto Presidente) a um nome relacionado na Coluna(A). (Exercício 05) Esse exemplo de planilha associa um nome que esta na coluna(A) a uma imagem (foto) (Path Ativo) de presidentes do Brasil. Observe que usei um Evento WorkSheet_SelectionChange(Ao Selecionar), em determinada área de células na folha de planilha.
‘//===========’
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range(“A2:A50”)) Is Nothing And Target.Count = 1 Then
[d1:d50].ClearContents
Application.EnableEvents = False
Application.ScreenUpdating = False
ChDir ActiveWorkbook.Path
On Error Resume Next
Shapes(“sbx_imagem”).Delete
sbx_imagem = Target & “.jpg”
Target.Offset(0, 2).Select
sbx_imagem = ActiveSheet.Pictures.Insert(sbx_imagem).Select
Selection.Name = “sbx_imagem”
Shapes(“sbx_imagem”).Left = ActiveCell.Left + 5
ActiveCell.Offset(0, 1).Value = Target.Value
ActiveCell.Offset(-1, 1).Select
Application.EnableEvents = True
End If
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 |
![]() |
![]() |
![]() |
<< Link Download: Verifique a Caixa de Itens Excluídos >> |
Planilha Excel VBA cursor 5 associar um nome a uma foto