Jknoll1122
New Member
- Joined
- Feb 9, 2021
- Messages
- 2
- Office Version
- 2016
- Platform
- Windows
Hello,
I have many shapes (78) that I need to change the size of when a cell value is changed. The following code works to change one shape but I'm struggling to get it to work with more than one shape.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRect As Rectangle
If Intersect(Target, Me.Range("l12:m13")) Is Nothing Then Exit Sub
Set myRect = Me.Rectangles("rectangle 8")
With myRect
.Width = Me.Range("l12").Value
.Height = Me.Range("m12").Value
End With
End Sub
How can I duplicate this code to apply to multiple shapes? This code also requires you to select the cell and enter a value before the shape changes. I would like the shape to change size as soon as the value is changed (cell value is a formula). Any help on this would be appreciated.
I have many shapes (78) that I need to change the size of when a cell value is changed. The following code works to change one shape but I'm struggling to get it to work with more than one shape.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRect As Rectangle
If Intersect(Target, Me.Range("l12:m13")) Is Nothing Then Exit Sub
Set myRect = Me.Rectangles("rectangle 8")
With myRect
.Width = Me.Range("l12").Value
.Height = Me.Range("m12").Value
End With
End Sub
How can I duplicate this code to apply to multiple shapes? This code also requires you to select the cell and enter a value before the shape changes. I would like the shape to change size as soon as the value is changed (cell value is a formula). Any help on this would be appreciated.