Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Checking to see if a file exists. | Excel Discussion (Misc queries) | |||
Checking if Sheet Exists? | Excel Discussion (Misc queries) | |||
Checking if file exists in VBA | Excel Programming | |||
Checking to see if Folder exists | Excel Programming | |||
Checking 2 c if workbook exists | Excel Programming |