michele227
New Member
- Joined
- Feb 15, 2023
- Messages
- 15
- Office Version
- 2019
- Platform
- Windows
Hi everyone,
I have a workbook with multiple sheets that require the same logo to be added (in certain sheets/cells listed below).
These are then changes by project - requiring a deletelogo macro as well.
I have the following code below that I am trying to adapt with no luck.
Also, I would like it to add the image (not the link) of the photo.
Thank you so much in advance
I am super new and appreciate all the help!
Request:
I'd like it to align with the edge of the selected cell.
It pastes like this:
But I would like to resize and crop it to look more like this (align with edge of H1):
Not sure if there is a way to allow me to fix one image and have the rest apply the same size or the same image?
These are the Sheets and cells within the sheets that I need it to add the Logos to:
This is the code I found:
I also have the code to delete the existing logo and replace it, but - it deletes all the other images in the workbook - which isn't good.
I have a workbook with multiple sheets that require the same logo to be added (in certain sheets/cells listed below).
These are then changes by project - requiring a deletelogo macro as well.
I have the following code below that I am trying to adapt with no luck.
Also, I would like it to add the image (not the link) of the photo.
Thank you so much in advance
I am super new and appreciate all the help!
Request:
I'd like it to align with the edge of the selected cell.
It pastes like this:
But I would like to resize and crop it to look more like this (align with edge of H1):
Not sure if there is a way to allow me to fix one image and have the rest apply the same size or the same image?
These are the Sheets and cells within the sheets that I need it to add the Logos to:
Sheets("Log").Range("G1").Select
Sheets("Notes S").Range("J1").Select
Sheets("Notes B").Range("J1").Select
Sheets("Notes L").Range("J1").Select
Sheets("Notes L").Range("J59").Select
Sheets("Conditions").Range("G1").Select
Sheets("Schedule").Range("H1").Select
Sheets("Form").Range("H1").Select
Sheets("Letter").Range("H1").Select
Sheets("Information").Range("H1").Select
Sheets("Text").Range("J1").Select
Sheets("Question").Range("J1").Select
Sheets("Sample").Range("J1").Select
Sheets("Align").Range("J1").Select
Sheets("Help").Range("J1").Select
Sheets("Example").Range("J1").Select
Sheets("Main").Range("J1").Select
This is the code I found:
Sub addLogo()
' Macro to automatically add the same project logo to each applicable sheet.
Dim myPicture As Variant
Dim p As Object
ChDir Sheets("Schedule").Range("O17").Value
myPicture = Application.GetOpenFilename("Pictures(*.png;*.jpg;*.jpeg;*.tif;*.bmp;*.gif),*.png;*.jpg;*.jpeg;*.tif;*.bmp;*.gif", , "Select Logo to Insert")
If myPicture = False Then Exit Sub
For Each Sheet In Sheets
Sheet.Activate
On Error Resume Next
Call deleteLogo
Range("G1").Select
Set p = ActiveSheet.Pictures.Insert(myPicture)
Next
End Sub
I also have the code to delete the existing logo and replace it, but - it deletes all the other images in the workbook - which isn't good.
Sub deleteLogo()
' Macro to delete all added Logos.
Dim myObj
Dim Picture
Set myObj = Range("G1").Select.DrawingObjects
For Each Picture In myObj
If Left(Picture.Name, 7) = "Picture" Then
Picture.Select
Picture.Delete
End If
Next
End Sub