![]() |
Checking to see if a Range Object exists?
Hi Everybody,
I'm using Excel 97 with VBA... Is there a way to programmatically check if a named Range exists i.e. I want to access === ActiveSheet.Range("Activity") <==== only if it exists. The problem is it'll crash referencing this if it doesn't exit? Thanks for any help! Sam |
Checking to see if a Range Object exists?
Hi debartsa
One way Sub test() Set Source = Nothing On Error Resume Next Set Source = Range("Activity") On Error GoTo 0 If Source Is Nothing Then MsgBox "The range don't exist.", _ vbOKOnly, "Hello" Else Range("Activity").Select End If End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "debartsa" wrote in message ... Hi Everybody, I'm using Excel 97 with VBA... Is there a way to programmatically check if a named Range exists i.e. I want to access === ActiveSheet.Range("Activity") <==== only if it exists. The problem is it'll crash referencing this if it doesn't exit? Thanks for any help! Sam |
Checking to see if a Range Object exists?
Thanks Ron,
I'll give it a try! Sam "Ron de Bruin" wrote in message ... Hi debartsa One way Sub test() Set Source = Nothing On Error Resume Next Set Source = Range("Activity") On Error GoTo 0 If Source Is Nothing Then MsgBox "The range don't exist.", _ vbOKOnly, "Hello" Else Range("Activity").Select End If End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "debartsa" wrote in message ... Hi Everybody, I'm using Excel 97 with VBA... Is there a way to programmatically check if a named Range exists i.e. I want to access === ActiveSheet.Range("Activity") <==== only if it exists. The problem is it'll crash referencing this if it doesn't exit? Thanks for any help! Sam |
All times are GMT +1. The time now is 05:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com