gtd526
Well-known Member
- Joined
- Jul 30, 2013
- Messages
- 684
- Office Version
- 2019
- Platform
- Windows
I can't find the 2nd or 3rd Shape I'm want to edit.
It locates the 1st one, but not the 2nd or 3rd.
I used "record macro" to select the shapes and get the name.
Sub PleaseFind()
ActiveSheet.Shapes("Rectangle 9").Select
ActiveSheet.Shapes("Rectangle 5").Select
ActiveSheet.Shapes("Rectangle 6").Select
End Sub
The actual code I'm using:
Dim Result As Integer
Dim Result2 As Integer
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''find Min and Max Values for Shape1
Result = Application.WorksheetFunction.Max(Range("a2:a20"))
MsgBox Result
Result2 = Application.WorksheetFunction.Min(Range("a2:a20"))
MsgBox Result2
''apply Min and Max Value to 1st Shape
With ActiveSheet.Shapes("Rectangle 9")
.Height = Result
.Width = 72 * 1.59
End With
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''find Min and Max Values for Shape2
Result = Application.WorksheetFunction.Max(Range("a21:a79"))
'MsgBox Result
Result2 = Application.WorksheetFunction.Min(Range("a21:a79"))
'MsgBox Result2
''apply Min and Max Value to 2nd Shape
''''''''''''''''''not finding Rectangle 5''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
With ActiveSheet.Shapes("Rectangle 5")
.Height = Result
.Width = 72 * 5.54
End With
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''find Min and Max Values for Shape3
Result = Application.WorksheetFunction.Max(Range("a80:a88"))
'MsgBox Result
Result2 = Application.WorksheetFunction.Min(Range("a80:a88"))
'MsgBox Result2
''apply Min and Max Value to 3rd Shape
''''''''''''''not finding Rectangle 6'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
With ActiveSheet.Shapes("Rectangle 6")
.Height = Result
.Width = 72 * 1.62
End With
Once I can find the 2nd and 3rd shape, I will ask how to set the height using Top and Bottom Values for the shape and the width according to columns in the chart. I'm using shapes to go over a Column Chart to define the Range of Min and Max values according to several columns in the chart.
Thanks for your help.
It locates the 1st one, but not the 2nd or 3rd.
I used "record macro" to select the shapes and get the name.
Sub PleaseFind()
ActiveSheet.Shapes("Rectangle 9").Select
ActiveSheet.Shapes("Rectangle 5").Select
ActiveSheet.Shapes("Rectangle 6").Select
End Sub
The actual code I'm using:
Dim Result As Integer
Dim Result2 As Integer
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''find Min and Max Values for Shape1
Result = Application.WorksheetFunction.Max(Range("a2:a20"))
MsgBox Result
Result2 = Application.WorksheetFunction.Min(Range("a2:a20"))
MsgBox Result2
''apply Min and Max Value to 1st Shape
With ActiveSheet.Shapes("Rectangle 9")
.Height = Result
.Width = 72 * 1.59
End With
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''find Min and Max Values for Shape2
Result = Application.WorksheetFunction.Max(Range("a21:a79"))
'MsgBox Result
Result2 = Application.WorksheetFunction.Min(Range("a21:a79"))
'MsgBox Result2
''apply Min and Max Value to 2nd Shape
''''''''''''''''''not finding Rectangle 5''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
With ActiveSheet.Shapes("Rectangle 5")
.Height = Result
.Width = 72 * 5.54
End With
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''find Min and Max Values for Shape3
Result = Application.WorksheetFunction.Max(Range("a80:a88"))
'MsgBox Result
Result2 = Application.WorksheetFunction.Min(Range("a80:a88"))
'MsgBox Result2
''apply Min and Max Value to 3rd Shape
''''''''''''''not finding Rectangle 6'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
With ActiveSheet.Shapes("Rectangle 6")
.Height = Result
.Width = 72 * 1.62
End With
Once I can find the 2nd and 3rd shape, I will ask how to set the height using Top and Bottom Values for the shape and the width according to columns in the chart. I'm using shapes to go over a Column Chart to define the Range of Min and Max values according to several columns in the chart.
Thanks for your help.