Share via

Excel 365 - How to Insert a Picture as a cell background?

Anonymous
2024-03-01T18:34:07+00:00

I want to add a picture as cell background and still see the text in the cell.

I want the picture to be constrained to the cell size, so that when the cell is copied, the picture does not try to resize in the new location.

I have tried doing this, but the only thing I can seem to do is place the image over the cell and then may it transparent, which results in a very poor effect. It also resizes when copied to a new location.

I have also tried to inert it as a background, but this seems to be for the entire page and not just the cell.

Does anyone know how to do this?

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

11 answers

Sort by: Most helpful
  1. Anonymous
    2024-08-13T08:06:17+00:00

    Nifty piece of code. Though perhaps one day Excel will be updated so adding a picture as a cell background will be a simple function.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2024-03-06T07:28:12+00:00

    Hi,

    NEW

    scenario

    Add picture in cell C3 (picture width = cell width / Ratio = True) as background (note: embedded in a shape)

    before

    Image

    .

    after

    Image

    .

    ======================

    vba macro

    Option Explicit

    Dim ws As Worksheet

    Dim r As Range

    Dim shp As Shape

    Dim sURL As String

    '

    Sub Add_Pic_in_Cell_C3()

    '## 06/03/2024 ##

    sURL = "https://img.freepik.com/free-photo/river-flowing-through-trees-mountains-scotland_181624-24054.jpg"

    Set ws = ActiveSheet

    Set r = ws.Range("C3")

    If ws.Shapes.Count > 0 Then

    For Each shp In ws.Shapes

    If Not Intersect(shp.TopLeftCell, r) Is Nothing Then

    shp.Delete

    End If

    Next shp

    End If

    Set shp = ws.Shapes.AddPicture(sURL, False, True, 0, 0, -1, -1)

    With shp

    .LockAspectRatio = msoTrue

    .Left = r.Left

    .Top = r.Top

    .Width = r.Width

    .TopLeftCell.RowHeight = .Height

    End With

    shp.Delete

    Set shp = ws.Shapes.AddTextbox(msoTextOrientationHorizontal, r.Left, r.Top, r.Width, r.Height)

    shp.Line.Visible = msoFalse

    With shp.Fill

    .Visible = msoTrue

    .UserPicture sURL

    .TextureTile = msoFalse

    .RotateWithObject = msoTrue

    .Transparency = 0.6

    End With

    End Sub

    =====================

    NOTE:

    1. the basic idea from this link https://www.mrexcel.com/board/threads/png-transparency.1137472/
    2. replace sURL with a picture from your pc

    sample:

    "C:\Users\otaso\Pictures\Tangram\cat.jpg"

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2024-03-03T15:32:40+00:00

    Thank you for the response and the code.

    I used the code and it ran as expected, now there is a picture and text both in the same cell. As you can see from the image below, the cell contains the text and the picture.

    This is as close as I have come so far.

    However, the text is covered by the picture.

    Is there a way to place the text in front of the picture?

    0 comments No comments
  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  5. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more