Dec 07 2022 11:37 PM
I need help please - I search on google without a solution.
For some reason my Microsoft 365 don't have the Image function.
I have a path to an image in range Sheet1.Range("G1") e.g., C:\Users.......jpg
I want to display/show that image in Sheet2.Range("K8")
or if I can display/load the image from the userform directly to Sheet2.Range("K8") it will also help.
Thank you
Dec 08 2022 12:36 AM
You can use code like this:
Dim rng As Range
Set rng = Sheet2.Range("K8")
Sheet2.Activate
rng.Select
With Sheet2.Pictures.Insert(Sheet1.Range("G1").Value)
.Width = rng.Width
.Height = rng.Height
End With
Dec 08 2022 01:14 AM
Dec 08 2022 01:43 AM
That would be
Dim rng As Range
Set rng = Sheet2.Range("K8")
Sheet2.Activate
rng.Select
With Sheet2.Pictures.Insert(Sheet1.Range("G1").Value)
.Width = Application.CentimetersToPoints(3.24)
.Height = Application.CentimetersToPoints(30.03)
End With
Dec 08 2022 01:46 AM
Dec 08 2022 03:16 AM
Dec 08 2022 03:45 AM
For example:
Dim rng As Range
Dim pic As Picture
Set rng = Sheet2.Range("K8")
' Delete Picture from K8
For Each pic In Sheet2.Pictures
If pic.TopLeftCell.Address = rng.Address Then
pic.Delete
Exit For
End If
Next pic
' Insert new picture
Sheet2.Activate
rng.Select
With Sheet2.Pictures.Insert(Sheet1.Range("G1").Value)
.Width = Application.CentimetersToPoints(3.24)
.Height = Application.CentimetersToPoints(30.03)
End With
Dec 08 2022 03:51 AM