+ Reply to Thread
Results 1 to 14 of 14

rotate a bar around a circle in excel

  1. #1
    Registered User
    Join Date
    11-08-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    45

    rotate a bar around a circle in excel

    I Want to rotate a bar around a circle in excel. I have the x and y offset of the bar set so the circle is at the bars end point.

    Using the following code the bar rotates about its mid point. How do I alter the code so it rotates about the circle I have at its end point?

    Please Login or Register  to view this content.
    Thanks Paul

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: rotate a bar around a circle in excel

    Perhaps you can post example workbook so we can know what you mean by bar.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    11-08-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: rotate a bar around a circle in excel

    Sorry its a rounded rectangle. Perhaps the following image explains it better? When I press play I want the rounded rectangle to rotate around the circle instead of its midpoint.

    Capture.PNG

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: rotate a bar around a circle in excel

    No not really, when I press the button nothing happens!

  5. #5
    Registered User
    Join Date
    11-08-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: rotate a bar around a circle in excel

    Ok, there's an example there

    Book1_example.xlsx

  6. #6
    Registered User
    Join Date
    11-08-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: rotate a bar around a circle in excel

    Code for button 1

    Please Login or Register  to view this content.
    Code for button 2

    Please Login or Register  to view this content.

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: rotate a bar around a circle in excel

    Keep it simple, in terms of calculating the position, by grouping with another shapes and rotate that about it's center.

    Obviously once you see how it's done you can format the rectangle to have no fill.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-08-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: rotate a bar around a circle in excel

    Ah I see! Cheers! Is there a way of rotating without grouping?

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: rotate a bar around a circle in excel

    Sure, but you would have to recalculate the left/top position of the shape given it's rotation.

  10. #10
    Registered User
    Join Date
    11-08-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: rotate a bar around a circle in excel

    Using a rotation matrix?

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: rotate a bar around a circle in excel

    Don't know what that means.

  12. #12
    Registered User
    Join Date
    11-08-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: rotate a bar around a circle in excel

    I mean do you use a rotation matrix to recalculate the left/top position of the shape given it's rotation?

  13. #13
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: rotate a bar around a circle in excel

    You just added more words rather than explained what a rotation matrix is.

    This code will rotate the shape around a point.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    11-08-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: rotate a bar around a circle in excel

    I meant I thought the new left position would become xcos theta + ysin theta and the new top position -xsin theta + ycos theta, never mind I was getting confused...

    Thanks for the code and you're time in helping me with this problem, I understand now.
    Last edited by Stanley91; 02-18-2014 at 01:20 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. rotate bar around circle
    By Stanley91 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2014, 12:35 PM
  2. Replies: 4
    Last Post: 12-17-2012, 11:45 PM
  3. [SOLVED] How do I set up a circle within a circle chart?
    By Ken in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-04-2006, 07:45 AM
  4. Circle in excel
    By David in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-24-2006, 02:25 PM
  5. How do I circle a number in excel
    By Dan Butler in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-04-2006, 05:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1