Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

determining when a range is invalid

  Asked By: Lorenzo    Date: Aug 24    Category: MS Office    Views: 655
  

I have a subroutine that defines a range called "place" as follows

Sub mySub(StartAddr As String, myValue as Integer)
Dim place As Range

Set place = Worksheets("Sheet1").range(StartAddr)
myValue = place(1,-4).Value ' is this off the edge of Sheet1?

End Sub

The StartAddr parameter takes a text range description such as "R5" or
"Y2" or something like that. However if the value "B5" is passed into
this subroutine, then an exception will be raised since it is trying
to reference a value that is 4 places to the left of the B column.

Is there some kind of test that I can make on

place(1,-4)

to make sure that such a range is going to be a valid cell reference
without raising an exception?

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on determining when a range is invalid Or get search suggestion and latest updates.




Tagged: