ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User defined data type (https://www.excelbanter.com/excel-programming/294767-user-defined-data-type.html)

augustus108

User defined data type
 
hi

Is it possible to create a user-defined data type of the following example

11.1 (ie, the data type must be within 99.9 to 00.0

I know I could use a For...Next to validate a input (say A1), or If Statement, but wouldn't be far more efficient if I could use VarType function

Also could someone tell me, why is it that when I test the following code in Immediate Window in VBE
a=11.
b=TypeName(a
print

I get b as Double, why is it that it ain't in Single?

Tom Ogilvy

User defined data type
 
A data type does not support limiting the values it can hold beyond storage
restrictions on the size of a value it can store. UDT's are made up of
standard data types.

As to the immediate window, what real diffence does it make. The immediate
window is for debugging. You can use implicit declarations if you need a
specific type.

--
Regards,
Tom Ogilvy

"augustus108" wrote in message
...
hi,

Is it possible to create a user-defined data type of the following

example:

11.1 (ie, the data type must be within 99.9 to 00.0)

I know I could use a For...Next to validate a input (say A1), or If

Statement, but wouldn't be far more efficient if I could use VarType
function?

Also could someone tell me, why is it that when I test the following code

in Immediate Window in VBE:
a=11.1
b=TypeName(a)
print b

I get b as Double, why is it that it ain't in Single?





All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com