P
Pete Mac
Hi,
I have a function that works when I pass in a string for a range name
I need to extend it to use an array and then loop it. Can't figure it out.
Any help appereciated
Works
If NameExists("exampleRangeName", Workbooks(ActiveWorkbook.Name)) Then
Doesn't work
MyRange(1,1)="exampleRangeName"
If NameExists((myRange(1 1)), Workbooks(ActiveWorkbook.Name)) Then
Function NameExists(WhatName As String, Optional WB As Workbook) As Boolean
Dim N As Long
On Error Resume Next
'Y = WB.Name
N = Len(IIf(WB Is Nothing, ThisWorkbook, WB).Names(WhatName).Name)
NameExists = (Err.Number = 0)
End Function
I have a function that works when I pass in a string for a range name
I need to extend it to use an array and then loop it. Can't figure it out.
Any help appereciated
Works
If NameExists("exampleRangeName", Workbooks(ActiveWorkbook.Name)) Then
Doesn't work
MyRange(1,1)="exampleRangeName"
If NameExists((myRange(1 1)), Workbooks(ActiveWorkbook.Name)) Then
Function NameExists(WhatName As String, Optional WB As Workbook) As Boolean
Dim N As Long
On Error Resume Next
'Y = WB.Name
N = Len(IIf(WB Is Nothing, ThisWorkbook, WB).Names(WhatName).Name)
NameExists = (Err.Number = 0)
End Function