Solved

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

Posted on 2013-12-16
4
580 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now