Set myRange = Nothing
on error resume next
Set myRange = aws.range("TestName") 'Assumes it's a worksheet name
'or
'Set myRange = Range("TestName") 'assumes it's a workbook name
on error goto 0
if not myRange is nothing then
'The range exists
else
'The range does not exist
end if
Thanks Barb. I started fooling around with a test in the sheet to give a
#ref! and then test for that in VB, but I think your solution will be much
more elegant! Regards, Brett.
Thanks JMB. I must be getting better at this - in the interim I came up with
If Range("last.account.test").Value = CVErr(xlErrRef) Then
Range("A27").End(xlDown).Select
ActiveWorkbook.Names.Add Name:="last.account", RefersToR1C1:=ActiveCell
End If
AND IT WORKS! Thanks for your help, Brett
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.