Question:
Is it possible in Excel to create a scroll bar (or something similar) which will rotate buttons clockwise?
2008-04-21 09:19:13 UTC
What I want to do in MS Excel using a scroll bar (or something similar), is create 6 buttons inside a oval shape which rotate clockwise as I scroll across, and then they rotate back anti-clockwise when I scroll back; each button having its turn at the top of the shape.

(I am thinking this could possibly be done by a macro, but I have no idea how to edit the code).

This is for a project that I am doing at school based on creating a system in excel.

Thanks for your help in advance.
Four answers:
Tim
2008-04-22 22:24:36 UTC
Yes, you can do this but it will require some VBA. Don't listen to the naysayers. :-)



Here is how (assuming Excel 2003 since you didn't say otherwise, but the same thing will work in Excel 2007 with only slight differences):



First, draw your shape and give it a name or select it and look in the space to the left of the formula bar to see the name that Excel gave it by default.



Next, go to View --> Toolbars and turn on the Forms toolbar. Click on the Scroll bar control and then draw it on the screen. Right click the scroll bar and choose Format Control. Set the options to whatever you want, and then set the cell link to K1 (you can change that, but that is what I'm using in the VBA code).



Next, press Alt-F11 to open the VBA editor. Right click on the project for your workbook and choose Insert --> Module. In that module paste this code:



Public Sub RotateShape()

ActiveSheet.Shapes("MyTriangle") .Rotation = ActiveSheet.Range("K1") .Value

End Sub



(Note: Everything from ActiveSheet.Shapes to .Value should be on one line.) Change "MyTriangle" to the name of your shape.



Finally, go back to the worksheet and right click the scroll bar control again. Choose Assign Macro and then select RotateShape from the list.



When you click the scroll bar, the shape should rotate to the right (clockwise). The amount will depend on the settings for the scroll bar control. When you scroll to the left, it will rotate back to the left.



That should get you started. Note that you can change K1 in the code above to another cell that has a formula that changes the rotation amount. This technique can get around the limitation that the minimum value of the control is 0.



I hope that helps.



Tim

http://www.tvmcalcs.com/blog/
2008-04-21 09:33:12 UTC
What you are trying to do in Excel is not I think possible because you want to use some form of animation and Excel does not support animated features, other than normal screentips. The only way possibly is to do it is to go through the whole procedure manually moving each button while recording a macro but I have doubts as to whether when you run the macro you will get the right effect.
2016-10-20 13:23:36 UTC
First I observed her going clockwise, then whilst i replaced into interpreting she replaced to counter clockwise, each and every time I regarded away she replaced course! This replaced into rather cool. Does it recommend i'm a left brained guy or woman because of the fact I observed her clockwise first? Or am I the two?
the_prankster
2008-04-21 09:29:27 UTC
You can't do this with a macro.

You would need to read the position of the scroll bar (which macro's can't do) and you would need to be able to set where it changes to the next picture.

It might be possible with VBA, but I' don't think so.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...