ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro for variable picture (https://www.excelbanter.com/excel-discussion-misc-queries/169413-macro-variable-picture.html)

_Nate

Macro for variable picture
 
....
Sheets("Actions").Select
Range("B16").Select
sImageToLoad = Sheets("Macros").Range("A2")
ActiveSheet.Pictures.Insert (sImageToLoad)
ActiveSheet.Shapes ("Picture 37")
Selection.ShapeRange.ScaleWidth 1.34, msoFalse,
msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.34, msoFalse,
msoScaleFromTopLeft
....

I need help with the proper format to make "Picture 37" a variable in
the function. Each time this step is run in large macro, the picture
number changes.

Many thanks in advance.
_Nate

joel

Macro for variable picture
 

PictureNumber = 137
PictureName = "Picture " & PictureNumber

Sheets("Actions").Select
Range("B16").Select
sImageToLoad = Sheets("Macros").Range("A2")
ActiveSheet.Pictures.Insert (sImageToLoad)
ActiveSheet.Shapes (PictureName)
Selection.ShapeRange.ScaleWidth 1.34, msoFalse,
msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.34, msoFalse,
msoScaleFromTopLeft


"_Nate" wrote:

....
Sheets("Actions").Select
Range("B16").Select
sImageToLoad = Sheets("Macros").Range("A2")
ActiveSheet.Pictures.Insert (sImageToLoad)
ActiveSheet.Shapes ("Picture 37")
Selection.ShapeRange.ScaleWidth 1.34, msoFalse,
msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.34, msoFalse,
msoScaleFromTopLeft
....

I need help with the proper format to make "Picture 37" a variable in
the function. Each time this step is run in large macro, the picture
number changes.

Many thanks in advance.
_Nate



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

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