+ Reply to Thread
Results 1 to 3 of 3

Get shape name as a cell value if shape has an outline of a certain colour

  1. #1
    Registered User
    Join Date
    10-28-2015
    Location
    Edmonton, Canada
    MS-Off Ver
    2013
    Posts
    13

    Get shape name as a cell value if shape has an outline of a certain colour

    I have about 50 shapes on my spreadsheet and about 10 are clickable, in that the shape changes its outline colour to black if selected. I am trying to write some code that will put the names of the selected shapes into a column on another worksheet. My problem is that my code counts the number of shapes that are selected and then returns shape names based on their index value not whether they were selected or not. Here is my code, please advise.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 12-30-2015 at 06:52 PM. Reason: Added Code Tags

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Get shape name as a cell value if shape has an outline of a certain colour

    Hi kamazonka,

    I Hope I understood your question correctly. I defined 'Selected Shapes' as shapes that are actually 'Currently Selected'.

    See the attached file that includes the following code:
    Please Login or Register  to view this content.
    It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
    Please Login or Register  to view this content.
    This option requires all variables to be declared and will give a compiler error for undeclared variables.

    I hope this helps.

    Lewis
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-28-2015
    Location
    Edmonton, Canada
    MS-Off Ver
    2013
    Posts
    13

    Re: Get shape name as a cell value if shape has an outline of a certain colour

    Thanks Lewis, this helps a lot.

+ 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. Automatically bringing a Shape into a Cell Using Shape Code
    By dineshtendulkar in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-16-2016, 02:25 PM
  2. Define Shape [Rectangle / L Shape] by cell content
    By SonOfOdin in forum Excel General
    Replies: 8
    Last Post: 12-30-2014, 06:17 AM
  3. Change shape colour dependent on cell value
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-26-2014, 07:44 AM
  4. Select a shape based on a cell value and update the shape when value changes
    By BigAl99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2013, 12:06 PM
  5. [SOLVED] Insert Diamond Shape for every Row and add cell value to each shape
    By bcn1988 in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 04-02-2013, 10:10 AM
  6. [SOLVED] VBA To Change Shape Outline
    By cmstroh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2012, 06:36 AM
  7. How to change a 'shape' foreground colour based on a cell contents
    By Farmboyuk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2012, 10:55 AM

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