PC Review


Reply
Thread Tools Rate Thread

To determine the data type of the selection range

 
 
Subodh
Guest
Posts: n/a
 
      30th Mar 2010
I have a range of 20 column by 30 rows
I want to check all the cells of the selection and then among the
selection
find out if the cell contains integer or error value or text or some
other data type.
Thanks in advance.
 
Reply With Quote
 
 
 
 
Nick H
Guest
Posts: n/a
 
      30th Mar 2010
Hi Subodh,

Try here...

http://www.cpearson.com/excel/CountType.aspx

....it might not be exactly what you're looking for but it should be a
good start.

Br, Nick
 
Reply With Quote
 
Bernard Liengme
Guest
Posts: n/a
 
      30th Mar 2010
This does a debug.print foe each cell
Boolean ends ups as "Empty"
best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme

Sub tryme2()
Set mydata = Selection
myrows = mydata.Rows.Count
mycols = mydata.Columns.Count
Debug.Print ; "-------------"
For j = 1 To myrows
For k = 1 To mycols
thiscell = mydata(j, k)
mytype = "Empty"
If WorksheetFunction.IsNumber(thiscell) Then
mytype = "Number"
If Int(thiscell) = thiscell Then mytype = "Integer"
End If
If WorksheetFunction.IsText(thiscell) Then mytype = "Text"
If mydata(j, k).HasFormula Then mytype = "Formula"
If WorksheetFunction.IsError(thiscell) Then mytype = "Error value"
If IsDate(thiscell) Then mytype = "Date"
Debug.Print j; k; mytype
Next k

Next j
End Sub


"Subodh" <(E-Mail Removed)> wrote in message
news:75a4cbbb-7eab-4584-870f-(E-Mail Removed)...
> I have a range of 20 column by 30 rows
> I want to check all the cells of the selection and then among the
> selection
> find out if the cell contains integer or error value or text or some
> other data type.
> Thanks in advance.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To determine if selection range contains empty rows Subodh Microsoft Excel Programming 3 30th Mar 2010 05:39 PM
How do you determine TYPE of incoming data Mike Microsoft VB .NET 3 15th Jun 2007 05:18 AM
Can I determine the active selection's type? MartinS Microsoft Excel Programming 4 13th Jan 2005 04:15 PM
How do I determine data type? Leanne Microsoft Access Form Coding 2 23rd Oct 2003 08:25 AM
Determine the data type of a column Bob Day Microsoft VB .NET 3 20th Sep 2003 12:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:46 PM.