KlausW
Active Member
- Joined
- Sep 9, 2020
- Messages
- 453
- Office Version
- 2016
- Platform
- Windows
Hi
I have some images that are automatically inserted into cells on different sheets with this code. This works perfectly. Now I would like a Marco for the images to fill the cells.
Anyone who can help?
Any help will be appreciated.
Best Regards Klaus W
Code to insert images looks like this.
I have some images that are automatically inserted into cells on different sheets with this code. This works perfectly. Now I would like a Marco for the images to fill the cells.
Anyone who can help?
Any help will be appreciated.
Best Regards Klaus W
Code to insert images looks like this.
VBA Code:
ub Find()
Dim A, B, c, d As Range ' a = området på "Billeder 1.deling med navne på foto, b = område i "Billeder" med navne på billeder, c = de enkelte celler i a, d = de enkelte celler i b
ActiveSheet.Pictures.Delete ' de gamle billeder slettes
Set A = Range("a4:d4,a8:d8,a12:d12,a16:d16,a20:d20") ' a defineres
Set B = Worksheets("Billeder").Range("a4:L12") ' b defineres
For Each c In A
For Each d In B
If c = d And c <> "" Then ' der testes om de enkelte celler i a findes i b
d.Offset(-1, 0).Copy Destination:=c.Offset(-1, 0) ' hvis de findes, kopieres cellen ovenover i "Billeder" til cellen ovenover i "Billeder 1.deling"
End If
Next
Next
End Sub
Last edited by a moderator: