ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Positioning all pictures (https://www.excelbanter.com/excel-discussion-misc-queries/96061-positioning-all-pictures.html)

gejmond

Positioning all pictures
 
Hi

Can anyone please advise on how to change the positioning properties
for 'all' the pictures on my spreadsheet?

In order to sort properly without the results distorting the pictures,
I need to set their positioning to "Move but don't size with cells".
Doing this individually would mean selecting format picture then going
on to the properties tab. However I can't seem to be able to do this
for multiple pictures, and I have lots.

I suspect the answer is in VBA (whatever that is!) I have used VBA
before to set up a macro for something but just followed exactly the
very good instructions from another poster, so I'm completely novice at
it really.

Any help would be greatly appreciated!

gejmond


Dave Peterson

Positioning all pictures
 
I got this when I recorded a macro (to fix one picture):

Option Explicit
Sub Macro1()
ActiveSheet.Shapes("Picture 1").Select
With Selection
.Placement = xlMove
.PrintObject = True
End With
End Sub


Getting rid of the .select and cycling through all the pictures, I could use
this:

Option Explicit
Sub testme()
Dim myPict As Picture
For Each myPict In ActiveSheet.Pictures
myPict.Placement = xlMove
Next myPict
End Sub

I also got rid of the .printobject stuff.

gejmond wrote:

Hi

Can anyone please advise on how to change the positioning properties
for 'all' the pictures on my spreadsheet?

In order to sort properly without the results distorting the pictures,
I need to set their positioning to "Move but don't size with cells".
Doing this individually would mean selecting format picture then going
on to the properties tab. However I can't seem to be able to do this
for multiple pictures, and I have lots.

I suspect the answer is in VBA (whatever that is!) I have used VBA
before to set up a macro for something but just followed exactly the
very good instructions from another poster, so I'm completely novice at
it really.

Any help would be greatly appreciated!

gejmond


--

Dave Peterson

gejmond

Positioning all pictures
 
Thanks v much Dave for replying

I copied and pasted:
Option Explicit
Sub testme()
Dim myPict As Picture
For Each myPict In ActiveSheet.Pictures
myPict.Placement = xlMove
Next myPict
End Sub


as a new macro. Not sure this is what you meant for me to do but it
doesn't seem to do anything. I will keep on playing with it....


Dave Peterson

Positioning all pictures
 
After you run the macro, right click on one of the pictures and see how the move
and size is set.

gejmond wrote:

Thanks v much Dave for replying

I copied and pasted:
Option Explicit
Sub testme()
Dim myPict As Picture
For Each myPict In ActiveSheet.Pictures
myPict.Placement = xlMove
Next myPict
End Sub


as a new macro. Not sure this is what you meant for me to do but it
doesn't seem to do anything. I will keep on playing with it....


--

Dave Peterson


All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com