+ Reply to Thread
Results 1 to 4 of 4

How to run macro everytime a shape is moved

  1. #1
    Registered User
    Join Date
    06-14-2016
    Location
    Bangalore,India
    MS-Off Ver
    2007
    Posts
    26

    How to run macro everytime a shape is moved

    This following macro changes color of selected shape if user moves its position.
    I assigned it to a button. I have to click on that button every time i move the shape to update the color. How do i do it automatically without using button?
    Please Login or Register  to view this content.
    Last edited by davesexcel; 02-01-2023 at 12:52 PM.

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: How to run macro everytime a shape is moved

    there is no way to trap shape selection
    the closest you probably could get is to have Onaction
    put this macro onto all the shapes and it should update the color once you have moved and then click on it

    probably no need to error trap if you are only assigning macro to shapes

    Please Login or Register  to view this content.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    06-14-2016
    Location
    Bangalore,India
    MS-Off Ver
    2007
    Posts
    26

    Re: How to run macro everytime a shape is moved

    Thank you humdingaling!!
    That is working!!
    But Are you u sure there is not any other way? Like creating any event or something?
    Actually My application is creating number of rectangle shapes. I used following code to create shape and assigned it to button -

    Please Login or Register  to view this content.
    Is there any way I assign the code you provided to the shape every time i create it?
    Last edited by davesexcel; 02-01-2023 at 12:51 PM.

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: How to run macro everytime a shape is moved

    to my knowledge there is no "event" for shape selection

    you can assign Onaction when you create the shape

    Please Login or Register  to view this content.

+ 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. Replies: 6
    Last Post: 10-20-2014, 09:37 AM
  2. Assign macro with parameter to shape based on shape location
    By bobo3127 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2014, 11:18 AM
  3. [SOLVED] A macro after setting onaction for a shape that will select the shape.
    By vonRobbo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2014, 11:34 PM
  4. [SOLVED] Use a button to control a macro that inserts an image into a shape or resets the shape
    By nwb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2013, 04:41 PM
  5. Replies: 0
    Last Post: 11-30-2012, 01:29 PM
  6. [SOLVED] creating a macro that inserts the current date in the same cell everytime the macro is run
    By katie1994 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-14-2012, 07:59 PM
  7. Run macro everytime cell content changes
    By minn in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-17-2008, 01:17 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