Urgent - Pl help code for assigning a shape to cells

  • Thread starter Thread starter Sarah
  • Start date Start date
S

Sarah

Hi Mates

Could some one please tell me how I could assign a shape
(or even a jpeg image) to a particular cell using a code.
And also how to make it appear at the center of the cell.

Thanks in advance

sarah
 
Hi Sarah

This will add a jpg file on top of C1

Sub test()
Dim Pict As Picture
With ActiveSheet.Range("c1")
Set Pict = .Parent.Pictures.Insert("C:\ron.jpg")
Pict.Top = .Top
Pict.Width = .Width
Pict.Height = .Height
Pict.Left = .Left
Pict.Placement = xlMoveAndSize
End With
End Sub
 
Hi Sarah,

The following code inserts a picture and gives it the same size and position
as the C3 cell.


Set x = ActiveSheet.Pictures.Insert( "C:\Sample.jpg")

With Range("C3")
x.Top = .Top
x.Left = .Left
x.Width = .Width
x.Height = .Height
End With
 

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

Back
Top