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.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

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.
 

Forum statistics

Threads
1,141,167
Messages
5,704,674
Members
421,360
Latest member
AJPlant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top