Test if range exists in VBA

前端 未结 4 1634
滥情空心
滥情空心 2020-12-17 17:14

I have a dynamically defined named range in my excel ss that grabs data out of a table based on a start date and an end date like this

=OFFSET(Time!$A$1,IFER         


        
4条回答
  •  隐瞒了意图╮
    2020-12-17 17:45

    Here is a function I knocked up to return whether a named range exists. It might help you out.

    Function RangeExists(R As String) As Boolean
        Dim Test As Range
        On Error Resume Next
        Set Test = ActiveSheet.Range(R)
        RangeExists = Err.Number = 0
    End Function
    

提交回复
热议问题