• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 637
  • Last Modified:

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


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?

Murray Brown
Murray Brown
  • 2
1 Solution
You mean you want to find out what format has currently been applied to the cell?
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
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
Rory ArchibaldCommented:
It's not really clear to me what you expect the function to actually return? (Noting of course that the cell format is not in any way a reliable indicator of the data type of its contents!)
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
You are right. It is unreliable
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now