LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 563
Default To determine the data type of the selection range

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" wrote in message
...
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.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
To determine if selection range contains empty rows Subodh Excel Programming 3 March 30th 10 05:39 PM
Excel ODBC Driver May Determine Wrong Data Type (Q141284) [email protected] Excel Programming 0 April 8th 08 09:17 PM
Determine data type in a string news.epix.net Excel Programming 5 October 31st 07 01:56 PM
Object Type of a selection... counting rows in a selection Acid-Sky[_2_] Excel Programming 3 August 23rd 05 09:53 AM
Determine data type for Pivot Field Mike Dudash Excel Programming 0 January 22nd 04 09:20 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"