PDA

View Full Version : Resize Pictures



rhudgins
04-29-2010, 11:52 AM
There are two charts in my attached sheet. I plan to add more charts to the sheet

Here is my code so far. I need to modify it so that I can click on any picture in the worksheet and run EnlargeCharts and then click again and run ResizeCharts





Sub EnlargeCharts()


ActiveSheet.Shapes("Picture 14").Select
Selection.ShapeRange.ScaleHeight 2.02, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleWidth 1.47, msoFalse, msoScaleFromBottomRight
Range("M33").Select

ResizeCharts


End Sub


Sub ResizeCharts()

ActiveSheet.Shapes("Picture 14").Select
Selection.ShapeRange.ScaleHeight 0.5, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleWidth 0.69, msoFalse, msoScaleFromBottomRight
End Sub

mbarron
04-29-2010, 12:01 PM
Get rid of the lines that select the charts since you'll already have selected them.
ActiveSheet.Shapes("Picture 14").Select

rhudgins
04-29-2010, 12:06 PM
That will not work. I need a macro to run this procedure on any picture that I click on, not just Picture 14. I will have over 50 pictures in my finished worksheet. How can this be done?

mbarron
04-29-2010, 12:12 PM
Did you even try it?

You said
I need to modify it so that I can click on any picture in the worksheet

When you click on the picture it become the selection.

If you remove this line of code like I suggested the macros will run against the selected picture.
ActiveSheet.Shapes("Picture 14").Select