Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Is is possible to extract the data type of a variable? For example let say I have two variables X and Y Dim X as Comment Dim Y as Range I now want to evalute what data type X is. Is their a property fo type? IF X.Type = Comment Then et -- ExcelMonke ----------------------------------------------------------------------- ExcelMonkey's Profile: http://www.excelforum.com/member.php...nfo&userid=522 View this thread: http://www.excelforum.com/showthread.php?threadid=27680 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Check out either TypeOf or TypeName()
-- Regards Juan Pablo González "ExcelMonkey" wrote in message ... Is is possible to extract the data type of a variable? For example lets say I have two variables X and Y Dim X as Comment Dim Y as Range I now want to evalute what data type X is. Is their a property for type? IF X.Type = Comment Then etc -- ExcelMonkey ------------------------------------------------------------------------ ExcelMonkey's Profile: http://www.excelforum.com/member.php...fo&userid=5221 View this thread: http://www.excelforum.com/showthread...hreadid=276807 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If you Dim x as comment it would always return "Comment", wouldn't it? Sub TypeTest() Dim x As Object Dim y As Variant Set x = ActiveCell x.Value = 1 y = x.Value 'Typename returns a string with the Class or Type name If TypeName(x) = "Range" Then Stop If TypeName(y) = "Double" Then Stop 'TypeOf can be used on objects 'note you use the IS keyword. If TypeOf x Is Range Then Stop End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam ExcelMonkey wrote : Is is possible to extract the data type of a variable? For example lets say I have two variables X and Y Dim X as Comment Dim Y as Range I now want to evalute what data type X is. Is their a property for type? IF X.Type = Comment Then etc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
extracting numbers from variable text | Excel Discussion (Misc queries) | |||
Extracting variable sized strings from binary file | Excel Programming | |||
How to find out the data type of a variable in VBA ? | Excel Programming | |||
What data type for Variable? | Excel Programming | |||
efine the data type of a variable | Excel Programming |