All the code I've found for removing worksheet defined names is similar to the code below and requires the name of the specific worksheet:
I can put this code at the beginning of each module, but a module I can call is of course a much better option.
Any ideas?
TIA
Ron
VBA Code:
Sub RemoveWsRangeNames()
'7-21-22
Dim rngName As Name
Dim ThisWb As Workbook
Dim ThisWs As Worksheet
'
Set ThisWb = ActiveWorkbook
Set ThisWs = ActiveSheet
'
With ThisWb
With ThisWs
'---remove any old defined names ---
For Each rngName In ThisWb.Names
If InStr(1, rngName, "ws_2Users") Then
rngName.Delete
End If
Next
End With 'ThisWs
End With 'ThisWb
End Sub
Any ideas?
TIA
Ron