Thread: Range or Array?
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_2_] Alan Beban[_2_] is offline
external usenet poster
 
Posts: 783
Default Range or Array?

Bob Phillips wrote:
"Alan Beban" wrote in message
...

Consider:

If IsArray(rng) Then
If TypeOf rng Is Range Then
MsgBox "Range"
Else
MsgBox "Array"
End If
End If



I decided to cater for other types passed as well.


But what happens to:

Sub abtest2()
Dim rng() As Integer
If TypeName(rng) = "Range" Then
MsgBox "Range"
ElseIf TypeName(rng) = "Variant()" Then
If IsArray(rng) Then
MsgBox "Array"
End If
End If
End Sub

In my code, the second line should be

If Typename(rng) = "Range" Then

Alan Beban