ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I align pictures to the columns in code (https://www.excelbanter.com/excel-programming/425642-how-can-i-align-pictures-columns-code.html)

Michelle

How can I align pictures to the columns in code
 
Hello, I want to bring in pictures and align and size them so that they sit
exactly between the borders of the B column

The left side of my shape should end up on the border between A and B and
the right side, on the border between B and C

Does that make sense?

The columns in the sheet may be different sizes so I'll need to include a
way of locating the left and right before positioning the picture. I can't
assume they'll always be the same.

Is this possible

Many thanks

M


Rick Rothstein

How can I align pictures to the columns in code
 
Try this (changing the worksheet name and picture shape name references to
what you are using in your code)...

With Worksheets("Sheet1").Shapes("Picture 1")
.Left = Range("B:B").Left
.Width = Range("B:B").Width
End With

--
Rick (MVP - Excel)


"Michelle" wrote in message
...
Hello, I want to bring in pictures and align and size them so that they
sit exactly between the borders of the B column

The left side of my shape should end up on the border between A and B and
the right side, on the border between B and C

Does that make sense?

The columns in the sheet may be different sizes so I'll need to include a
way of locating the left and right before positioning the picture. I can't
assume they'll always be the same.

Is this possible

Many thanks

M




All times are GMT +1. The time now is 04:57 AM.

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