OldDogNewTricks
New Member
- Joined
- Jun 27, 2014
- Messages
- 21
This is the code I have been using to delete the names of rows when a button is clicked. It is no longer working, and I am not sure why. Any suggestions? I have tried it with and without my little warning message box.
Please and thank you!
Please and thank you!
Code:
'This deletes ROW NAMES on THIS worksheet.
'This should be clicked before naming rows to provide a clean slate.
'In case this is clicked by mistake, it will first ask the user if this is what (s)he wants.
If MsgBox("This will delete all row names on this worksheet. Do you wish to continue?", vbYesNo + vbQuestion) = vbNo Then
Exit Sub
End If
Dim N As Name
On Error Resume Next
For Each N In ActiveWorkbook.Names
If N.RefersToRange.Worksheet.Name = ActiveSheet.Name Then
If Range(Mid(N.RefersTo, 2)).Columns.Count = Columns.Count Then N.Delete
End If
Next N
On Error GoTo 0
End Sub
[COLOR=#333333]
[/COLOR]
Last edited: