ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add drop shadow to cells (https://www.excelbanter.com/excel-programming/289999-add-drop-shadow-cells.html)

liner

Add drop shadow to cells
 
I am using a recorded a macro that loops through a series of sheets and adds a shadow effect to a cluster of cells, say B5:G8 and it works fine. This code follows:

ActiveSheet.Shapes.AddShape(msoShapeRectangle, 1.4, 40.6, 568.8, 51.3).Select
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Shadow.Obscured = msoTrue
Selection.ShapeRange.Shadow.Type = msoShadow14

The problem is, if the column widths change from one sheet to the next (and they do) then the drop shadow is out of line on subsequent sheets.

How can I get the drop shadow to apply to a range address rather than the sheet coordinates (pixels?) recorded?

Your example code would be most helpful. Thanks in advance.

This only needs to run once per sheet.

Ron de Bruin

Add drop shadow to cells
 
Maybe this

ActiveSheet.Shapes.AddShape(msoShapeRectangle, Range("B5").Left, Range("B5").Top, _
Range("B5:g8").Width, Range("B5:b8").Height).Select
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Shadow.Obscured = msoTrue
Selection.ShapeRange.Shadow.Type = msoShadow14


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"liner" wrote in message ...
I am using a recorded a macro that loops through a series of sheets and adds a shadow effect to a cluster of cells, say B5:G8

and it works fine. This code follows:

ActiveSheet.Shapes.AddShape(msoShapeRectangle, 1.4, 40.6, 568.8, 51.3).Select
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Shadow.Obscured = msoTrue
Selection.ShapeRange.Shadow.Type = msoShadow14

The problem is, if the column widths change from one sheet to the next (and they do) then the drop shadow is out of line on

subsequent sheets.

How can I get the drop shadow to apply to a range address rather than the sheet coordinates (pixels?) recorded?

Your example code would be most helpful. Thanks in advance.

This only needs to run once per sheet.




liner

Add drop shadow to cells
 
Thanks!


All times are GMT +1. The time now is 06:36 PM.

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