Forum Discussion

LizeMarie's avatar
LizeMarie
Brass Contributor
Dec 08, 2022

Load Image/Picture to cell Range using image path C:\

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

7 Replies

  • LizeMarie 

     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
    • LizeMarie's avatar
      LizeMarie
      Brass Contributor
      Thank you so much Hans it works! Yeah!
      The range are merged cells, how can I change the width and height accordingly Height must be 30.03 cm and width 3.24 cm
      Thank you again Hans - I struggled with this for more than 2 days' 🙂 Highly appreciate your reply
      • HansVogelaar's avatar
        HansVogelaar
        MVP

        LizeMarie 

        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

Resources