Loading
Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports



Results 1 to 5 of 5

Thread: Using Shape Names

  1. #1
    Join Date
    9th December 2003
    Location
    Yorkshire, England
    Usergroup
    Registered Users
    Posts
    29

    Using Shape Names

    I need to access and use the Name of Shapes but cannot work out how. Clicking on a shape is to run a macro and the macro needs to pick up the name of the shape clicked on and then use it.

    The line of code needs to be something like:
    ActiveCell = Sheets("Front").ActiveShape.Name & ": " & "(" & Entry.What & ")" & " " & Entry.Info

    The "Sheets("Front").ActiveShape.Name" is clearly wrong syntax.

    How do I access and use Shape Name?

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Usergroup
    Moderators
    Posts
    19,377
    You will have to use the actual shapes name, eg

    ActiveSheet.Shapes("AutoShape 1").Select
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

  3. #3
    Join Date
    9th December 2003
    Location
    Yorkshire, England
    Usergroup
    Registered Users
    Posts
    29
    Thanks RoyUK, but the point is I need to click on the shape to activate the Macro and use the name of the Shape in the macro. There are 60-odd shapes throughout the workbook!

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    7th March 2003
    Location
    Essex, England
    Usergroup
    OzMVP
    Posts
    11,310
    Hi Darslg,

    Use the Application.Caller property to return the name of the shape.

    Sub ClickAnyShape()
    MsgBox ActiveSheet.Shapes(Application.Caller).Name & " Clicked"
    End Sub

    Cheers
    Andy

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Usergroup
    Moderators
    Posts
    19,377
    Working with Andy's code

    ActiveCell.Value = Sheets("Front").Shapes(Application.Caller).Name& ": " & "(" & Entry.What & ")" & " " & Entry.Info
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Compare 1st X letters of Names To Other Names
    By G_Seattle in forum Excel General
    Replies: 8
    Last Post: April 2nd, 2008, 10:21
  2. Replies: 7
    Last Post: March 30th, 2008, 07:39
  3. Replace Part Names Of Range Names With Text
    By Yzerman19 in forum Excel General
    Replies: 2
    Last Post: October 20th, 2007, 07:02
  4. Draw Shape Confined Within Another Shape
    By vizhn in forum Excel General
    Replies: 1
    Last Post: June 28th, 2007, 09:08
  5. Selecting more than 1 shape
    By Dave Taylor in forum Excel General
    Replies: 3
    Last Post: January 17th, 2005, 20:26

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
  •  
porno