marrydale
asked on
excal vba problem: range
Hi,
I have some coding as below, but i just don't know how to continue it:
......
dim rangeA as Range
dim sht as Worksheet
set sht=ActiveSheet
......
if aaa+1<>bbb then
set rangeA = Range(sht.Cells(aaa+1,1), Cells(bbb-1,sht.UsedRange. Columns.Co unt))
end if
If <expression here!> Then
msgbox "rangeA is valid"
rangeA.select
<more steps here....>
Else
msgbox "rangeA is not valid"
End If
how i gonna write the code in the <expression here!> to determine whether the "rangeA" is a valid range or not. Meaning if aaa=2 and bbb=3, from the coding, we know that rangeA will be nothing. In the second "if-statement", i will check whether the rangeA is valid or not, if valid, i will do some manipulation on it, if not, i will continue to the next step. how to write it in code? hope somebody can help me on this a.s.s.p. I need it urgently. thanks!
cheers,
marry
I have some coding as below, but i just don't know how to continue it:
......
dim rangeA as Range
dim sht as Worksheet
set sht=ActiveSheet
......
if aaa+1<>bbb then
set rangeA = Range(sht.Cells(aaa+1,1), Cells(bbb-1,sht.UsedRange.
end if
If <expression here!> Then
msgbox "rangeA is valid"
rangeA.select
<more steps here....>
Else
msgbox "rangeA is not valid"
End If
how i gonna write the code in the <expression here!> to determine whether the "rangeA" is a valid range or not. Meaning if aaa=2 and bbb=3, from the coding, we know that rangeA will be nothing. In the second "if-statement", i will check whether the rangeA is valid or not, if valid, i will do some manipulation on it, if not, i will continue to the next step. how to write it in code? hope somebody can help me on this a.s.s.p. I need it urgently. thanks!
cheers,
marry
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
marry,
Set rangeA = Nothing
Brad
Set rangeA = Nothing
Brad
marry,
Thanks for the grade!
Brad
Thanks for the grade!
Brad
ASKER
thanks, it help me a lot!
one small portion of question i forgot to ask just now, the rangeA actually is in a for-loop. so i have to reset it into nothing after it have run one loop. how to code it? meaning how to reset it into nothing?
cheers,
marry