ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Align picture to the right side of a cell... (https://www.excelbanter.com/excel-programming/423574-align-picture-right-side-cell.html)

SpeeD

Align picture to the right side of a cell...
 
Hi to all...

I need to align a picture to the right side of a cell, but i cant make this
work.. i can do it to the left...

Dim myPict As Picture
With ActiveSheet.Range("B5")
Set myPict = .Parent.Pictures.Insert("C:\jorge\jorge.jpg")
myPict.Top = .Top
myPict.Left = .Left
myPict.Placement = xlMoveAndSize

This is an insert code, but you get the picture...

Can anyone help me?

Thanks in advance
SpeeD

SpeeD

Align picture to the right side of a cell...
 
Thanks a lot Rick

Ill try that.

SpeeD

"Rick Rothstein" wrote:

Try it this way...

Dim myPict As Picture
With ActiveSheet.Range("B5")
Set myPict = .Parent.Pictures.Insert("C:\jorge\jorge.jpg")
myPict.Top = .Top + .Height - myPict.Height
myPict.Left = .Left + .Width - myPict.Width
myPict.Placement = xlMoveAndSize
End With

I note (because you are using a cell near the edge of the worksheet) that if
aligning the picture to the cell would make part of the picture go out of
the worksheet, the picture will be moved so that all of it is in the
worksheet.

--
Rick (MVP - Excel)


"SpeeD" wrote in message
...
Hi to all...

I need to align a picture to the right side of a cell, but i cant make
this
work.. i can do it to the left...

Dim myPict As Picture
With ActiveSheet.Range("B5")
Set myPict = .Parent.Pictures.Insert("C:\jorge\jorge.jpg")
myPict.Top = .Top
myPict.Left = .Left
myPict.Placement = xlMoveAndSize

This is an insert code, but you get the picture...

Can anyone help me?

Thanks in advance
SpeeD





All times are GMT +1. The time now is 10:14 PM.

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