Resizing a Picture

L

Longbow

Hello,

Could some one please help me with the following?

I need a macro that when a user selects a picture on my spreadsheet
(named "items") then the macro will automatically format the selected
picture with the following format picture criteria:

Height = 10.11cm
Width = 14.92cm
Height = 253%
Width = 249%
lock aspect ratio = true
relative to original picture size = true
Original size = 4cm Height x 6cm Width

Any help would be greatly appreciated.

Thanks,

Chris.

Live Long and Prosper :)

*** Sent via Developersdex http://www.developersdex.com ***
 
S

Susan

start the macro recorder
select a picture & resize it the way you want it.
end the macro recorder
see what you've got!
(hint - remove the "selection" part, so it will work with whatever
picture is selected).
:)
susan
 
L

Longbow

Hi Susan,

Thanks for your reply. I ran the following macro and received a
run-time error stating that the item with the specified name could not
be found.

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 28/03/2007 by User
'

'
ActiveSheet.Shapes("Picture 21").Select
Selection.ShapeRange.ScaleWidth 2.48, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 2.48, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.02, msoFalse, msoScaleFromTopLeft
End Sub

The first line of my macro code will not run according to the VBE that
highlights it in yellow after I debug the run-time error.

Could you please advise on how I can get around this problem.

Many thanks,

Chris.

Live Long and Prosper :)

*** Sent via Developersdex http://www.developersdex.com ***
 
S

Susan

good! yes, as to the problem you're having, remove this statement:

ActiveSheet.Shapes("Picture 21").Select

every time you add a shape or a picture, excel gives it a different
#. it's hard to keep track of them, because if you delete, say,
picture15, the next one inserted will not be another picture15, but
will be picture22 (or whatever # comes after the last one you
inserted).

if you take that line out, you can select a picture, any picture, and
run the macro, & it will reshape that one picture.
so if you add this macro to a toolbar button, you can select the
picture, and push the button, & it will reshape it.

hope this helps!
susan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top