ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   put the company logo in "A1" of sheets 4 to 44 (https://www.excelbanter.com/excel-programming/371410-put-company-logo-a1-sheets-4-44-a.html)

Max Bialystock[_2_]

put the company logo in "A1" of sheets 4 to 44
 
What's the most efficient way to put the company logo in "A1" of sheets 4 to
44 of a workbook?



Corey

put the company logo in "A1" of sheets 4 to 44
 
The below code wil place a picture and size it to the marked sizes in ALL
sheets in a workbook for you,
modify to suit sheets i gues.

+++++++++++++++++++++++++++++++++
Sub Picture_Adder()
Application.ScreenUpdating = False
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim myPic As Picture
Dim res As Variant
Const sAddress As String = "A1"
Set WB = activeworkbook
res = Application.GetOpenFilename _
("Image Files (*.jpg), *.jpg")
If res = False Then Exit Sub

For Each SH In WB.worksheets
Set rng = SH.Range(sAddress)
Set myPic = SH.Pictures.Insert(res)
With myPic
.Top = rng.Top
.Left = rng.Left
myPic.ShapeRange.LockAspectRatio = msoTrue
myPic.ShapeRange.Height = 83.5 ' <======================= Modify
'myPic.ShapeRange.Width = 105 ' <====================== Modify
myPic.ShapeRange.Rotation = 0#
End With
Next SH
Application.ScreenUpdating = True
End Sub


+++++++++++++++++++++++++++++++++++++++
--
Regards

Corey
"Max Bialystock" wrote in message
...
What's the most efficient way to put the company logo in "A1" of sheets 4
to 44 of a workbook?




Max Bialystock[_2_]

put the company logo in "A1" of sheets 4 to 44
 
Thank you.


"Corey" wrote in message
...
The below code wil place a picture and size it to the marked sizes in ALL
sheets in a workbook for you,
modify to suit sheets i gues.

+++++++++++++++++++++++++++++++++
Sub Picture_Adder()
Application.ScreenUpdating = False
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim myPic As Picture
Dim res As Variant
Const sAddress As String = "A1"
Set WB = activeworkbook
res = Application.GetOpenFilename _
("Image Files (*.jpg), *.jpg")
If res = False Then Exit Sub

For Each SH In WB.worksheets
Set rng = SH.Range(sAddress)
Set myPic = SH.Pictures.Insert(res)
With myPic
.Top = rng.Top
.Left = rng.Left
myPic.ShapeRange.LockAspectRatio = msoTrue
myPic.ShapeRange.Height = 83.5 ' <======================= Modify
'myPic.ShapeRange.Width = 105 ' <====================== Modify
myPic.ShapeRange.Rotation = 0#
End With
Next SH
Application.ScreenUpdating = True
End Sub


+++++++++++++++++++++++++++++++++++++++
--
Regards

Corey
"Max Bialystock" wrote in message
...
What's the most efficient way to put the company logo in "A1" of sheets 4
to 44 of a workbook?







All times are GMT +1. The time now is 07:00 AM.

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