PDA

View Full Version : Change the image size in terms of the value of a cell



yahiaoui
10-24-2011, 10:33 AM
hi ....
can I Change the image size in terms of the value of a cell
Thanks in advance

mdmackillop
10-24-2011, 12:33 PM
Yes.

This will resize in relation to the screen resolution

Option Explicit
Option Compare Text

Public ScrWidth&, ScrHeight&
Declare Function GetSystemMetrics32 Lib "User32" _
Alias "GetSystemMetrics" (ByVal nIndex&) As Long

Sub SizePic()
Dim SizeFactor, x
SizeFactor = Range("A1").Value
ActiveSheet.Shapes(1).Width = SizeFactor * (GetSystemMetrics32(0))
End Sub

yahiaoui
10-24-2011, 02:37 PM
Thank you very much

The solution was close
I sent a file
I hope to consider it

yahiaoui
10-25-2011, 11:13 PM
up

mancubus
10-26-2011, 02:01 AM
hi yahiaoui.


hi ....
can I Change the image size in terms of the value of a cell
Thanks in advance


and mdmackillop's code resizes your picture based on cell A1 value, as you requested.

the problem being what?

yahiaoui
10-26-2011, 03:07 AM
Thanks for the reply




The solution was close
I sent a file
I hope to consider it

I want to resize the image
So that it appears part of the picture

mancubus
10-26-2011, 07:37 AM
what image?
Image (ActiveX Control)?
and load a picture to that control from worksheet?
and change the control size to fit loaded picture?