May 01 2018
- last edited on
Jul 25 2018
I am new to VBA and macros and I was hoping that someone could help me writing the VBA to insert a photo from your personal files. I created the button, but I just need to write the VBA to pull up the users files so they can select the photo. From there I want the photo to be placed in the cell (you'll see on the sheet which cell I am referring to). The cells are already merged together. I want the photo to fit in the cell that is already merged.
For some reason this forum won't let me upload a macro, so I am going to insert the excel file. You'll see where I want the photo's on the "FLYER V1" tab.
Thanks! Let me know if you have any questions
Apr 17 2021 04:59 PM
Jun 06 2021 08:42 PM
Aug 24 2022 06:12 PM
I like the code below. I tried it and changed it so that it aligns uniformly across.
My goal is to add multiple images, at one time please advise how that can be done.
Oct 03 2022 03:35 AM
Thank you very much, indeed!
I just modified your code to override Aspect Ratio:
Dim fNameAndPath As Variant
Dim img As Object
fNameAndPath = Application.GetOpenFilename(Title:="Select Picture To Be Imported")
If fNameAndPath = False Then Exit Sub
Set img = ActiveSheet.Pictures.Insert(fNameAndPath)
'Resize Picture to fit in the range....
.ShapeRange.LockAspectRatio = msoFalse
.Left = ActiveSheet.Range("A5").Left
.Top = ActiveSheet.Range("A5").Top
.Width = ActiveSheet.Range("A5:G5").Width
.Height = ActiveSheet.Range("A5:A20").Height
.Placement = 1
.PrintObject = True