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

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?

1
0
Murray Brown
Asked:
Murray Brown
  • 2
1 Solution
 
CodeCruiserCommented:
You mean you want to find out what format has currently been applied to the cell?
0
 
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
0
 
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!)
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
You are right. It is unreliable
0
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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