Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
ISUTUBBS
 
Posts: n/a
Default Picutres in Excel Cell

I've been trying to insert a picture into a cell and can only insert it into
the sheet. I've seen on this board that a cell can only contain text or a
formula. Is there any way to get a picture to be associated with the cell
such that if the rows are sorted the pictures sort with them?

I can do this in Word tables, but Excel offers some features I want to
utilize.

Kind Regard
  #2   Report Post  
Ken Macksey
 
Posts: n/a
Default

Hi

You can insert a picture in a cell.This will insert a picture into a single
cell or a merged cell.
Just change the range address and picture path/name to suit.

Dim Rng As Range
With Worksheets("Sheet1")
Set Rng = .Range("B9").MergeArea
.Shapes.AddPicture "C:\pictures\Sample.jpg", _
msoFalse, msoTrue, Rng.Left, Rng.Top, Rng.Width, Rng.Height
End With


I haven't tried sorting, but don't see why it should not sort with the
cells.
You can experiment with it and see.

If you would like to see a workbook with 4 different ways of inserting
pictures into cells, email me and I will send it to you.

HTH

Ken


  #3   Report Post  
JE McGimpsey
 
Posts: n/a
Default

No, you really *can't* insert a picture IN a cell. The picture exists in
the drawing layer above the cell. Whether it stays on top of the cell
depends on the picture's properties.

Your macro inserts a picture into the *worksheet* (hence your
"Worksheets("Sheet1").Shapes.Add..."). But the cell is unchanged - its
value and all other properties are the same as they were - it can only
contain a constant or formula.

Likewise, selecting the picture doesn't select the cell. In fact, you
can't select the cell with the mouse if the picture covers it (you can,
though, using arrow, tab or enter keys).

OTOH, your guess is right that, if you select the column with the
pictures, the pictures will sort, but *only* if the picture's .Placement
property is set to either Move and size with cells, or Move but don't
size with cells.

Since you're assuming that the picture should fill the cell, you'd
probably do better to set the picture to move and size with the cell,
rather than the default move but don't size:

With Worksheets("Sheet1").Range("B9").MergeArea
.Parent.Shapes.AddPicture("C:\pictures\Sample.jpg" , _
False, True, .Left, .Top, .Width, .Height).Placement = _
xlMoveAndSize
End With


In article ,
"Ken Macksey" wrote:

Hi

You can insert a picture in a cell.This will insert a picture into a single
cell or a merged cell.
Just change the range address and picture path/name to suit.

Dim Rng As Range
With Worksheets("Sheet1")
Set Rng = .Range("B9").MergeArea
.Shapes.AddPicture "C:\pictures\Sample.jpg", _
msoFalse, msoTrue, Rng.Left, Rng.Top, Rng.Width, Rng.Height
End With


I haven't tried sorting, but don't see why it should not sort with the
cells.
You can experiment with it and see.

If you would like to see a workbook with 4 different ways of inserting
pictures into cells, email me and I will send it to you.

HTH

Ken

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
How Can I make a cell flash in Excel monir Excel Discussion (Misc queries) 0 February 4th 05 03:41 AM
Excel: how to formulate conditional cell references centraloffice Excel Worksheet Functions 1 December 10th 04 08:57 PM
Paste rows of numbers from Word into single Excel cell BecG Excel Discussion (Misc queries) 1 December 8th 04 04:55 PM


All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"