ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Urgent - Pl help code for assigning a shape to cells (https://www.excelbanter.com/excel-programming/311627-urgent-pl-help-code-assigning-shape-cells.html)

SARAH

Urgent - Pl help code for assigning a shape to cells
 
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


Ron de Bruin

Urgent - Pl help code for assigning a shape to cells
 
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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sarah" wrote in message ...
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




John Green[_4_]

Urgent - Pl help code for assigning a shape to cells
 
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



"Sarah" wrote in message
...
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





All times are GMT +1. The time now is 06:28 AM.

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