View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
big t big t is offline
external usenet poster
 
Posts: 40
Default Any quicker ideas?

Hi everyone,

I'm using the following code to check a range exists on a worksheet:

Public Function RangeExists(rangeName As String) As Boolean
Dim var As Variant

RangeExists = False
On Error GoTo BadRange
If rangeName < "" Then
var = Range(rangeName)
RangeExists = True 'will raise error where range does not exist
'therefore to get here, it must
Exit Function
End If

BadRange:
End Function

and it works fine. The trouble is I call this function about 34000 times and
it takes approx 14 seconds to run.

Any ideas for a faster way to check a range exists?

TIA
big t