Sub Macro() j = 3 While Cells(j, 2).Value <> "" j = j + 1 Wend j = j - 1 For i = 3 To j Code = Cells(i, 2).Value jpg = ".jpg" Archive = "Z:\Fotos Vivero las Fresas\fotos de la web\Plantas WEB\" & Code & jpg Set filesys = CreateObject("Scripting.FileSystemObject") If filesys.FileExists(Archive) Then AdressCode = "http://www.vlasfresas.com/ampliar_imagen.php?cod=" & Code Cells(i, 1).Select ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ AdressCode, TextToDisplay:="Foto" With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With End If Next End Sub