Forum Discussion
Chris_George
Feb 02, 2022Copper Contributor
Controlling a Shape (arrow) based on value
Is it possible to change a shape based on value? I would like to have a sliding arrow that moves to match the students current level. As you can see in the photo, if the student is level 1 then t...
JMB17
Feb 02, 2022Bronze Contributor
I think you would need a macro to do that. You could adjust the progress arrow's width by taking the Level shapes left value and subtracting the progress arrows left value. But, you would need to figure out how you want to activate the macro, whether it is attached to a button that you click to update, or if you have the macro run when you input a value into a particular cell, or when the worksheet calculates, etc.
This appears to work (but, it's incomplete as it would still need some logic to decide which level the arrow needs to be adjusted to):
Sub Macro1()
With Worksheets("Sheet1")
.Shapes("ProgressArrow").Width = .Shapes("Level1").Left - .Shapes("ProgressArrow").Left
End With
End Sub
Chris_George
Feb 07, 2022Copper Contributor
Thank you for your advice. I eventually went with using a variety of arrow lengths and then using an INDIRECT lookup to the appropriate arrow length.
https://www.xelplus.com/excel-lookup-on-pictures/
https://www.xelplus.com/excel-lookup-on-pictures/