Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net Excel Add-in Find which data type an Excel cell is

Hi

I need to automatically detect which data type shown on the numbers form of the Format
Excel interface is. What VB.net code do I use to do this?

User generated image
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

You mean you want to find out what format has currently been applied to the cell?
Avatar of Murray Brown

ASKER

Yes, thanks.

So far I am using the following function

   Public Function GetNumberFormat(MyCell As Range) As String
        GetNumberFormat = MyCell.NumberFormat
    End Function

So for instance a Number with one decimal place is 0.0 and then with a number separater #,###0,0. See I am really just looking for a list of what each type of cell variation will return
ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You are right. It is unreliable