+ Reply to Thread
Results 1 to 3 of 3

Using drawing object in code when it activates the macro

  1. #1
    Registered User
    Join Date
    07-20-2010
    Location
    Peoria, IL
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question Using drawing object in code when it activates the macro

    I am creating a sorting application in which I have up and down arrows above columns that are used to sort the the rows using advanced sorting options. However, I would like to create a single sub that sorts the column that the arrow is in, and reuse this sub for every arrow. I tried to use Selection.TopLeftCell.Select, and assign the macro to each arrow. I thought that when I clicked the arrow to activate the macro, it would count as "selecting" the arrow, but this did now work. Is there any way to code it so that it knows which arrow was clicked?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Using drawing object in code when it activates the macro

    Here's the code I use to do that:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-20-2010
    Location
    Peoria, IL
    MS-Off Ver
    Excel 2003
    Posts
    2

    Smile Re: Using drawing object in code when it activates the macro

    Thanks a lot! I got it to work. Looks like I needed to dimension a Shape variable and then set it equal to ActiveSheet.Shapes(Application.Caller). From there, I could use the TopLeftCell function on the new Shape variable.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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