+ Reply to Thread
Results 1 to 10 of 10

Excel Ctrl Tilde To Show Named Range

Hybrid View

  1. #1
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,046

    Re: Excel Ctrl Tilde To Show Named Range

    Modified to test the validity


    Sub ShowNamedRange()
    Dim nm As Name
    Dim myName As String
    Dim shp As Shape
    Dim blnShowing As Boolean
    Dim l&, t&, w&, h&
    
    For Each shp In ActiveSheet.Shapes
        If Left(shp.Name, Len("Named Range")) = "Named Range" Then
            shp.Delete
            blnShowing = True
        End If
    Next
    
    If blnShowing = False Then
        For Each nm In ActiveWorkbook.Names
            On Error Resume Next
            myName = ""
            myName = nm.RefersToRange.Parent.Name
            On Error GoTo 0
            If Len(myName) Then
                If nm.RefersToRange.Parent.Name = ActiveSheet.Name Then
                    With nm.RefersToRange
                        l = .Left
                        t = .Top
                        w = .Width
                        h = .Height
                    End With
                
                    With ActiveSheet.Shapes.AddShape(msoShapeRectangle, l, t, w, h)
                        .Name = "Named Range " & nm.Name
                        .Fill.ForeColor.RGB = RGB(80, 240, 180)
                       .TextFrame.Characters.Text = nm.Name
                        .TextFrame.Characters.Font.ColorIndex = 1
                    End With
                End If
            End If
        Next nm
    End If
    End Sub

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Excel Ctrl Tilde To Show Named Range

    Quote Originally Posted by ByteMarks View Post
    Modified to test the validity
    Thanks for the assist
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. How to get my named range to show its value (1 cell)
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2018, 03:58 PM
  2. [SOLVED] Show/Hide Rows Columns based on value in named range
    By Andrew-Mark in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2016, 07:13 AM
  3. [SOLVED] If Yes then only show these items in new table or named range
    By RussB in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-27-2015, 10:27 PM
  4. Show column to left of named range when clicking hyperlink
    By Crispld in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-31-2014, 06:48 PM
  5. Insert and Show formula with a named range
    By amphinomos in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-03-2014, 12:27 PM
  6. Only show sheet name in list if the name is stored in a named range
    By lukestkd in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-28-2013, 03:51 PM
  7. problem with userform show data from a named range
    By jpruffle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2009, 06:39 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