I have used the following codes:
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA: Hide all named ranges in Excel
<strong>Sub HideNames()
'Update 20140318
Dim xName As Name
For Each xName In Application.ActiveWorkbook.Names
xName.Visible = False
Next
End Sub
</strong>
3. Then press F5 key to run this code, and all of the named ranges in your workbook have been hidden.
However, after I hit F5, it pop up a window asking me for Macro name. After I add a name, then it show up a i=window saying there is compile error. I really do not know what I have done wrong. I have attached sample here. Can someone please take a look and let me know what I have done wrong? Thanks.
Bookmarks