Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing for existence of range
Greetings,
TIA for any help In the sub below, how can i test for the existence of the Range referred to in rng <rng is nothing seems to be the wrong idea. Sub Test() Dim rng As Range Set rng = Range("A1, A4, A6, A8") rng.EntireRow.Select Selection.Delete MsgBox rng Is Nothing ' returns 'False' End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing for existence of range
Not exactly sure of your question. If you change the line of you code Msgbox rng is nothing to: Set rng = Nothing then the code is good. Your question - how do I test for the existence of the Range "rng" It exists when you create it with your Set statement. Maybe your question is how do I check for the values in the rng? Can you clarify ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing for existence of range
Thanks for your response
Let's say I start off with <Dim rng as range Set rng = Range("A1:A3") Now I delete Rows 1 to 3 The contents of rng have now disappeared How do I test that the contents of range have dissapeared? TIA |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing for existence of range
set rng = rows("1:3")
rng.Delete on Error resume next msgbox rng.Address if err.number < 0 then msgbox "rng has been deleted" err.clear set rng = nothing End if On Error goto 0 rng is not nothing - but the object it referred to is gone. -- Regards, Tom Ogilvy "David" wrote in message ... Thanks for your response Let's say I start off with <Dim rng as range Set rng = Range("A1:A3") Now I delete Rows 1 to 3 The contents of rng have now disappeared How do I test that the contents of range have dissapeared? TIA |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing for existence of range
Tom,
Thanks for coming to my rescue once more |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TESTING A RANGE OF CELLS | New Users to Excel | |||
TESTING A RANGE OF CELLS | Excel Worksheet Functions | |||
Testing a person's age to be within a range | Excel Worksheet Functions | |||
Testing for existence of a formula | Excel Worksheet Functions | |||
Cell in Range Testing Function | Excel Programming |