Image to appear on all worksheets if placed on 1 worksheet. POSSIBLE ?

C

Corey

Is it possible to place say a JPG or Logo onto say worksheet 1 and ALL the worksheets in that workbook, will ALSO have that image placed
in the same position as the image in worksheet 1?

I do not what it to be placed into the header though.
If so, how would I go about this?

Corey....
 
C

Corey

Or alternately is it possible to set up a macro that will prompt for a (jpg or gif) image on the PC, then after
selecting a image it is placed into a range of cells on a specific worksheet?

Is this possible?
How?

Corey....
Is it possible to place say a JPG or Logo onto say worksheet 1 and ALL the worksheets in that workbook, will ALSO have that image placed
in the same position as the image in worksheet 1?

I do not what it to be placed into the header though.
If so, how would I go about this?

Corey....
 
N

Norman Jones

Hi Corey,

Try something like:

'=============>>
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim myPic As Picture
Const sAddress As String = "D1" '<<==== CHANGE
Const sStr As String = _
"C:\My Pictures\Excel.bmp" '<<==== CHANGE
Set WB = ThisWorkbook '<<==== CHANGE

For Each SH In WB.Worksheets
Set rng = SH.Range(sAddress)
Set myPic = SH.Pictures.Insert(sStr)
With myPic
.Top = rng.Top
.Left = rng.Left
End With
Next SH
End Sub
'<<=============


---
Regards,
Norman


Is it possible to place say a JPG or Logo onto say worksheet 1 and ALL the
worksheets in that workbook, will ALSO have that image placed
in the same position as the image in worksheet 1?

I do not what it to be placed into the header though.
If so, how would I go about this?

Corey....
 
C

Corey

Thanks.
Norman, or anyone else.
Is the below code able to be enhanced with a PROMPT to manually choose the
image then it placed in the designated cell?

'=============>>
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim myPic As Picture
Const sAddress As String = "A1"
Const sStr As String = _
"C:\My Pictures\Excel.bmp" '<<==== CHANGE to whatever
the result of the prompt is
Set WB = Activeworkbook
For Each SH In WB.Worksheets
Set rng = SH.Range(sAddress)
Set myPic = SH.Pictures.Insert(sStr)
With myPic
.Top = rng.Top
.Left = rng.Left
End With
Next SH
End Sub
'<<=============

Corey....
 
N

Norman Jones

Hi Corey,
Norman, or anyone else.
Is the below code able to be enhanced with a PROMPT to manually choose the
image then it placed in the designated cell?

Try:
'=============>>
Public Sub Tester2()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim myPic As Picture
Dim res As Variant
Const sAddress As String = "D1" '<<==== CHANGE
Set WB = ThisWorkbook '<<==== CHANGE

res = Application.GetOpenFilename _
("Bitmap Files (*.bmp), *.bmp")
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
End With
Next SH
End Sub
'<<=============
 
C

Corey

Thank You again Norman,
You are a true gentleman.

Exactly as required.
Thanks

Corey....
 
N

Norman Jones

Hi Corey,

If you wish to enable the user to select bmp or jpg files, try changing:

to

res = Application.GetOpenFilename _
("Image Files (*.bmp;*.jpg), *.bmp;*.jpg")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top