Catalogo insertando en excel fotos desde carpeta

He intentado mas de 20 macros distintas pero no consigo una que funcione para colocar la imagen en cada celda de acuerdo al código del producto

2 respuestas

Respuesta
2

H o l a : Te anexo la macro

Sub InsertarImagen()
'Por.Dante Amor
    On Error Resume Next
    ruta = ThisWorkbook.Path & "\"
    ActiveSheet.Pictures.Delete
    For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
        arch = Dir(ruta & Cells(i, "A") & ".*")
        If arch <> "" Then
            With Cells(i, "B")
                Arr = .Top + 1
                Izq = .Left + 1
                Anc = .Width - 2
                Alt = .Height - 2
            End With
            '
            Set fotografia = ActiveSheet.Pictures.Insert(ruta & arch)
            With fotografia
                .Placement = xlMoveAndSize
                '.ShapeRange.LockAspectRatio = msoFalse
                .Top = Arr
                .Left = Izq
                .Width = Anc
                .Height = Alt
            End With
            Set fotografia = Nothing
        End If
    Next
End Sub

'S aludos. Dante Amor. Recuerda valorar la respuesta. G racias
Respuesta

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas