rachidaitali
New Member
- Joined
- Nov 10, 2021
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
- Mobile
I need your help to create macro or something to be able to :
1-have a button in the middle of the cell
2- when pressing the button : it will past from clipboard to the cell and fit automatically in the middle without adjusting the size and properties.
I have tried the below but doesn't seems the picture fit the cell, it's all the time bigger.
Public Sub PastAndMove()
Const TargetRange = "A51:J57"
Dim s As Object
ActiveSheet.Paste
Set s = Selection.ShapeRange
s.Top = (Range(TargetRange).Height - s.Height) / 2 + Range(TargetRange).Top
s.Left = (Range(TargetRange).Width - s.Width) / 2 + Range(TargetRange).Left
End Sub
can you please have a look, much appreciate your support and help
1-have a button in the middle of the cell
2- when pressing the button : it will past from clipboard to the cell and fit automatically in the middle without adjusting the size and properties.
I have tried the below but doesn't seems the picture fit the cell, it's all the time bigger.
Public Sub PastAndMove()
Const TargetRange = "A51:J57"
Dim s As Object
ActiveSheet.Paste
Set s = Selection.ShapeRange
s.Top = (Range(TargetRange).Height - s.Height) / 2 + Range(TargetRange).Top
s.Left = (Range(TargetRange).Width - s.Width) / 2 + Range(TargetRange).Left
End Sub
can you please have a look, much appreciate your support and help