Solved

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

Posted on 2013-12-16
4
594 Views
Last Modified: 2013-12-19
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
Comment
Question by:murbro
  • 2
4 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39721244
You mean you want to find out what format has currently been applied to the cell?
0
 

Author Comment

by:murbro
ID: 39721264
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
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 39723427
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
 

Author Closing Comment

by:murbro
ID: 39731142
You are right. It is unreliable
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question