Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Testing if Variant is Range or Double?

So I rewrote my interpolation function to take in input as a numeric array
that can be either in Option Base 0 or 1. It is a Variant. Is there some
way I can tell if this input is a range instead of numeric? Then I can
convert it to values and make this new function also handle the argument
that the exisiting function takes. And so replace it.

Don <donwiss at panix.com.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Testing if Variant is Range or Double?

Don,

Sub test()
Dim var As Variant

var = CDbl(123.456)
' Set var = Range("A1")
If TypeOf var Is Range Then MsgBox "It's a range" Else MsgBox "It's not
a range"
End Sub

Rob

"Don Wiss" wrote in message
...
So I rewrote my interpolation function to take in input as a numeric array
that can be either in Option Base 0 or 1. It is a Variant. Is there some
way I can tell if this input is a range instead of numeric? Then I can
convert it to values and make this new function also handle the argument
that the exisiting function takes. And so replace it.

Don <donwiss at panix.com.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Testing if Variant is Range or Double?

Rob van Gelder wrote:

Sub test()
Dim var As Variant

var = CDbl(123.456)
' Set var = Range("A1")
If TypeOf var Is Range Then MsgBox "It's a range" Else MsgBox "It's not a range"
End Sub


Thanks! It worked like a charm in XP. I couldn't find where "TypeOf var Is
Range" comes from. It will also have to work under 97.

Don <donwiss at panix.com.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Testing if Variant is Range or Double?

Look under help for IF

(see the options under condition).

It is supported in Excel 97.

--
Regards,
Tom Ogilvy

Don Wiss wrote in message
...
Rob van Gelder wrote:

Sub test()
Dim var As Variant

var = CDbl(123.456)
' Set var = Range("A1")
If TypeOf var Is Range Then MsgBox "It's a range" Else MsgBox "It's

not a range"
End Sub


Thanks! It worked like a charm in XP. I couldn't find where "TypeOf var Is
Range" comes from. It will also have to work under 97.

Don <donwiss at panix.com.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I assign range to variant and use Mike H[_2_] Excel Discussion (Misc queries) 7 June 7th 07 01:40 AM
TESTING A RANGE OF CELLS Richard[_2_] New Users to Excel 3 April 1st 07 02:52 PM
TESTING A RANGE OF CELLS Richard[_2_] Excel Worksheet Functions 3 April 1st 07 02:52 PM
Testing a person's age to be within a range MH Excel Worksheet Functions 10 December 31st 06 10:04 PM
Testing for existence of range David Excel Programming 4 November 19th 03 07:39 AM


All times are GMT +1. The time now is 06:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"