inserted pictures

rbsinc

New Member
Joined
Oct 18, 2006
Messages
1
The first column of my worksheet contains inserted pictures from a file. I would like to sort the worksheet based upon criteria in different columns. When I try, the sort changes the positions of the inserted pictures. They do not necessarily follow the row in which they were placed. The pictures are not tied or locked to the cell in which they were placed. I have tried locking and protecting the cells and rows and worksheet. Nothing works. When I protect the rows, Excel does not allow me to sort. How can I lock the inserted picture into the cell in which it was placed and then lock that cell to the row in which it is contained. Then, will this allow me to sort the rows of the worksheet without the pictures moving? In other words, if I sort the rows, I want the inserted picture to follow the cell and row into which it was originally placed...not move to a different row.
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

sunnyland

Well-known Member
Joined
Jan 27, 2006
Messages
912
hie there,

One way to go about it will be to have an extra column where you will put the name of the picture object

Let say I have a picture called Picture 1 which is in row 3, now in the column C in row 3 [the new created column] I will type Picture 1

Then I will not sort via the menu
I will use the following macro:

Code:
Sub SortAndRelocate()
Application.Dialogs(xlDialogSort).Show
Dim picture1top As Long
Dim rangi As Range
Set rangi = Range("c:c").Find("Picture 1")
If Not rangi Is Nothing Then
picture1top = rangi.Top
Sheet1.Shapes("Picture 1").Top = picture1top
End If
End Sub

What the code does is after sorting, it will look for value Picture 1 in column C if found, it will position the Picture ("Picture 1") with the same top as row found.
 

Watch MrExcel Video

Forum statistics

Threads
1,111,598
Messages
5,541,163
Members
410,543
Latest member
ExcelGlenn
Top