ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   variant to integer format? (https://www.excelbanter.com/excel-programming/363741-variant-integer-format.html)

James Cornthwaite

variant to integer format?
 
Hi


For the times when variant contains an integer, how do i convert it to
integer type?

is it some thing like?
......................
dim varies As Variant
dim x As integer

if i know varies contains an integer value
x = integer(varies)

Also can a function which is said to return a variant, return an integer
type and the cell calling the function display an integer type or will just
appear as a variant type. I know a variant has no specific type but does
this mean it can accept various types and which are then tread as the
original type or is variant a type in itself, rather than a variable which
can be a variety of types?

Many thanks
James



AA2e72E

variant to integer format?
 
Try:

x = Cint(varies)



All times are GMT +1. The time now is 10:17 AM.

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