macro list of name ranges includes some i dont want

KDS14589

Board Regular
Joined
Jan 10, 2019
Messages
180
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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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,213,535
Messages
6,114,194
Members
448,554
Latest member
Gleisner2

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