Solved

Put a picture in a cell

Posted on 2011-02-11
10
224 Views
Last Modified: 2012-05-11
Hi,

I have an excel and between 2 textlines i have a picture.
The picture i not in the cell but on top of it.
When i take copy of the whole range i don't have the picture.
Is there a way to put the picture in a cell?

Tx
0
Comment
Question by:sonmic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 6

Expert Comment

by:Eric Zwiekhorst
ID: 34869780
Dear Sonmic,

If you go to the picture propertys
You should select MOVE AND SIZE WITH CELLS.

Then it will copy with the selected range..
You can not put it in a cell...

kr

Eric
0
 
LVL 42

Expert Comment

by:dlmille
ID: 34869784
This should get you started.  Its not perfect and to the best of my understanding you can't insert into a picture  -  it will float, but you can put it at the top/left adjacencies...

Sub Tester()
Dim myPict As Picture

    With ActiveCell
        Set myPict = .Parent.Pictures.Insert("C:\Users\....\Pictures\Dbl click Here.jpg")
        myPict.Top = .Top
        myPict.Left = .Left
    End With

End Sub
0
 

Author Comment

by:sonmic
ID: 34869817
Insert the picture is not a problem. but when i take a copy of the range and the picture is in the middle and i do a paste the picture is not in pasted range.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 42

Expert Comment

by:dlmille
ID: 34869822
Select the range around the picture, then copy/paste - I just did it and it worked.  at least manually.

Dave
0
 
LVL 42

Expert Comment

by:dlmille
ID: 34869853
Follow this form:

Sub copyPict()

    Range("OriginalPict").Select
    Selection.Copy
    Range("Dest").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
End Sub


see attached

Dave
copyPastePicture-r1.xlsm
0
 
LVL 45

Accepted Solution

by:
patrickab earned 500 total points
ID: 34869960
sonmic,

It's worth noting that even if you position a picture in a cell it is not attached to that cell. The only way attach a picture to a cell is to insert a picture into a cell Comment. That can be done manually or by means of a simple macro like this:

Sub insert_pic_in_comment()
    Range("A1").AddComment
    Range("A1").Comment.Visible = True
    Range("A1").Comment.Text Text:="Sunset" & Chr(10) & ""
    Range("A1").Comment.Shape.Fill.UserPicture _
        "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg"
End Sub

Correct the path to the picture to suit your requirements.

Patrick
0
 
LVL 6

Expert Comment

by:Eric Zwiekhorst
ID: 34870031
Dear Patrick,

I did try it (Excel 2003) from the comment itself but did not succeed.

I did run the macro and to my supprise it was there.

Never to old to learn...


Kind regards


Eric
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34870155
Eric,

It can be done manually too:
Right-click and Format Comment
Select the Colors and Lines tab
Click the Color: dropdown and choose Fill Effects... at the bottom
Switch to picture tab and choose your picture.

HTH
Rory
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34871348
sonmic - Thanks for the grade - Patrick
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34871710
Eric,

It's rare that I can tell the old hands anything at all!

Patrick
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question