Home » excel » vba – Problem with reading excel cell value to a VARIANT

vba – Problem with reading excel cell value to a VARIANT

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m reading a excel cell value to a VARIANT data type from VBA code.
When I enter a integer value to the cell, the VARIANT always takes the argument as type double. Please help me to rectify this problem.

Thank you

How to&Answers:

Excel Cells do not have an integer type: Excel numbers are always doubles.
So there is no way of getting an integer/long variant subtype except by doing an implicit or explicit conversion.