when I copy a worksheet I get message "name already defined"
Something's happening in your situation that I can't replicate....So...Try
this:
1)Open a new workbook
2)Open the VBE [Alt]+[F11]
3)Insert a new Module
4)Copy the code below into that module:
Option Explicit
Sub ListActShtRngNames()
Dim strText As String
Dim intNameCount As Integer
Dim intCtr As Integer
Dim blnMakeVisible As Boolean
strText = ""
Select Case MsgBox( _
Title:="Hidden Range Name Option", _
Prompt:="Do you want to force all hidden range names to be made
visible?", _
Buttons:=vbCritical + vbYesNoCancel)
Case vbYes:
blnMakeVisible = True
Case vbNo:
blnMakeVisible = False
Case vbCancel
Exit Sub
End Select
With ActiveWorkbook
intNameCount = .Names.Count
For intCtr = 1 To intNameCount
strText = strText & Names(intCtr).Name & " " _
& Names(intCtr).Visible & " " _
& Names(intCtr).RefersTo & vbCr
If Names(intCtr).Visible = False Then
Names(intCtr).Visible = blnMakeVisible
End If
Next intCtr
End With
MsgBox strText
End Sub
5)Compile the project DebugCompile VBA Project
6)No errors, except for the wrapped line (I hope). If you run into problems,
let me know what they are, OK?
Otherwise:
7)Go to the workbook and run the code:
ToolsMacroMacrosListActShtRngNames
It should run (even without any range names). Then try it with range names.
NOTE: To run it on another workbook, the workbook with the code has to be
open, too. OR you could put it in your PERSONAL.XLS workbook so it would
always be available.
Waiting to hear from you . . .
--
Regards,
Ron
|