macro to execute change of shape size

cjcass

Well-known Member
Joined
Oct 27, 2011
Messages
683
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I currently have the code below placed into a wksheet that changes the size of an arrow when the value (from a formula) in cell B13 automatically changes.
I would like to be in control of when to execute this routine using a command button / macro at any time that will simply just change the arrow size based on B13's value.
What would the code be to achieve this? many thanks.

Private Sub Worksheet_Calculate()
If Range("B13").Value > 0 Then
Shapes("YourselfArrow").Height = Range("B13").Value
End If
End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Put this part of the code into a separate macro and then attach that macro to a button on the sheet:
Code:
If Range("B13").Value > 0 Then
   Shapes("YourselfArrow").Height = Range("B13").Value
End If
 
Upvote 0
Hi,
I tried that and it gave me an error as follows:
'Sub or Function not defined' with the word 'Shapes' highlighted
 
Upvote 0
Try:
Rich (BB code):
If Range("B13").Value > 0 Then
   ActiveSheet.Shapes("YourselfArrow").Height = Range("B13").Value
End If
 
Upvote 0
Brilliant! tha works great
Thanks very much indeed :)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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