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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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:
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,501
Messages
6,114,010
Members
448,543
Latest member
MartinLarkin

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
Back
Top