Excel - Excel - Macro para insertar imágenes solo cuando se incluya un código

 
Vista:

Excel - Macro para insertar imágenes solo cuando se incluya un código

Publicado por Manuel (1 intervención) el 26/02/2016 08:40:12
Hola a todos,

Tengo un problema con una macro que inserta imágenes indistintamente si en las celdas se han incluido códigos o no. La macro es la siguiente:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Sub insertarimagen()
'Por.DAM
On Error Resume Next
ruta = ActiveWorkbook.Path & "\"
For i = 1 To Range("A" & Rows.Count).End(xlUp).Row
 imagen = Cells(i, "A")
 Set img = ActiveSheet.Pictures.Insert(ruta & imagen)
 With Cells(i, 2)
 Arr = .Top
 Izq = .Left
 Anc = .Offset(0, 1).Left - .Left
 Alt = .Offset(1, 0).Top - .Top
 End With
 With img
 '.Name = numimg
 .ShapeRange.LockAspectRatio = msoFalse
 .Top = Arr
 .Left = Izq
 .Width = Anc
 .Height = Alt
 End With
 Set img = Nothing
Next
End Sub

Lo que deseo es que la macro inserte imágenes SÓLO donde se incluya un código, dejando vacías las celdas sin códigos. Les agradeceré por su ayuda.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder