macro list of name ranges includes some i dont want

KDS14589

Board Regular
Joined
Jan 10, 2019
Messages
203
Office Version
  1. 2016
Platform
  1. Windows
I have a macro for listing all name ranges in active workbook when a certain worksheet is activated. the code is
Code:
Sub Rprt()
Dim nm As Name, n As Long, y As RANGE, z As Worksheet
Application.ScreenUpdating = False
Set z = ActiveSheet
n = 8
With z
    .[a5:O155].ClearContents
    .[a7] = [{"Name"}]
    For Each nm In ActiveWorkbook.Names
        .Cells(n, 2) = nm.Name
        
        n = n + 1
    Next nm
End With
End Sub
but it list 4 that I don't want
_xlfn.AGGREGATE
_xlfn.COUNTIFS
_xlfn.IFERROR
_xlfn.SUMIFS
what can I do to stop listing them?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Unsatisfying and inelegant but just screen them out using Like? Something along the lines of

If Not nm Like "_xlfn*"
 
Upvote 0
How about
Code:
    For Each nm In ActiveWorkbook.Names
        If Left(nm.Name, 5) <> "_xlfn" Then
            .Cells(n, 2) = nm.Name
            n = n + 1
        End If
    Next nm
 
Upvote 0
Check if the values ​​also appear with this.

Code:
Sub test()
  Range("B8").ListNames
End Sub
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,737
Messages
6,180,643
Members
452,992
Latest member
TokugawaIesuma

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top