Add Shadows To Shape & Dont Move or Size with cell in VBA

a_t_a

New Member
Joined
Nov 22, 2017
Messages
10
hi

with this marco i add Oval shape to sheet
Code:
Sub OvalClick_()
Dim i As Long
i = Range("N2")

ActiveSheet.Shapes.AddShape(msoShapeOval, 480, 170, 200, 200).Select
   Selection.ShapeRange.Fill.Visible = msoFalse
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
  Selection.ShapeRange.Line.Weight = 2.5
  Selection.ShapeRange.Line.foreColor.RGB = RGB(48, 48, 48)
  Selection.Name = "Oval " & i
Range("N2").Value = Range("N2").Value + 1

End Sub

i want add shadow to shape and check mark "Dont Move or Size with cell"
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,590
Office Version
  1. 2013
Platform
  1. Windows
Try this to add Dont Move or Size with cell

See line of code marked in red.
To add shadow would depend on how much shadow etc. etc.
Try using the Macro recorder and then make the shape the way you want and then you can read the code.

Code:
Sub My_Shapes()
Sub OvalClick_()
Dim i As Long
i = Range("N2")
ActiveSheet.Shapes.AddShape(msoShapeOval, 480, 170, 200, 200).Select
   Selection.ShapeRange.Fill.Visible = msoFalse
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
  Selection.ShapeRange.Line.Weight = 2.5
  Selection.ShapeRange.Line.ForeColor.RGB = RGB(48, 48, 48)
  Selection.Name = "Oval " & i
  [COLOR=#ff0000]Selection.Placement = xlFreeFloating[/COLOR] ' this line of code added
Range("N2").Value = Range("N2").Value + 1
End Sub
 
Last edited:

a_t_a

New Member
Joined
Nov 22, 2017
Messages
10
tanx "Dont Move or Size with cell" worked.
you can help me to find proprety of shadows transparenty ,size ,blure, angel, color, and distance
link on web or e book of proprety shadow
 

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
10,311
You could try right clicking the shape and then click 'Format Shape'. This will give you a selection of formats to choose from. The effectiveness of the format will most likely depend on the shape.
 

a_t_a

New Member
Joined
Nov 22, 2017
Messages
10
i Found code:
Code:
Selection.ShapeRange.Shadow.Transparency = 0
Selection.ShapeRange.Shadow.Visible = True
Selection.ShapeRange.Shadow.Blur = 5
Selection.ShapeRange.Shadow.OffsetX = 5
Selection.ShapeRange.Shadow.OffsetY = 5
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,590
Office Version
  1. 2013
Platform
  1. Windows
Glad you have this working the way you want
See the reason I had no answer was I did not know what type shadow how much etc.
If you use the Macro Recorder you can do things exactly like you want on these type request
And then if you know how just copy the parts of the code you need.
Hope you did not think I did not want to help you.


i Found code:
Code:
Selection.ShapeRange.Shadow.Transparency = 0
Selection.ShapeRange.Shadow.Visible = True
Selection.ShapeRange.Shadow.Blur = 5
Selection.ShapeRange.Shadow.OffsetX = 5
Selection.ShapeRange.Shadow.OffsetY = 5
 

Watch MrExcel Video

Forum statistics

Threads
1,130,112
Messages
5,640,174
Members
417,130
Latest member
Darion2021

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top