LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Differentiate between Number and Date?

You should test for Boolean before testing for numeric

If rng.Value = True Or rng.Value = False Then


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Merle via OfficeKB.com" <u17293@uwe wrote in message
news:5a3fa28a8a4b6@uwe...
Bob,

I think the code I posted basically does what you describe in your second
paragraph - goes down through each cell, checks to see whether there's
anything in it, if so tests its value for formula, number, whatever.

I would put

=CellType(A4:A2000)

...at the top of every column I want to find what type of values are in

that
column, changing the "A" to the appropriate column letter.

That part of the function works. What doesn't appear to work is the

ability
to determine whether the cell's value is a logical (True/False) as opposed

to
a numerical. Excel interprets the words "TRUE" and "FALSE" as numbers. I
can't figure out how to differentiate between the two.

Merle

Bob Phillips wrote:
Merle,

In a UDF you usually do just the single action. Your UDF might look at

many
cells, but it returns just one result. You do NOT try and get a UDF to
return a result for the complete range (well, actually you can, but let's
keep it a bit simpler here).

So, in this case, I would not see a UDF going down a range of cells to

work
out whether each is a formula, number or whatever, but rather to have a

UDF
to check the first cell in your range, passing that cell as an argument

to
the UDF, then the next and so on.

Thus, I see no merit in knowing here how to looping through the range,

you
don't need to. Using the UDF I gave, you can put

=CellType(A1) in one cell, and
=CellType(A2) in another, each will be independently evaluated.

Does this make sense?

Ah, well, I guess I was trying to be both brief and not expose my

elementary
programming (sigh). Here's the full code which might help you better

help me.
[quoted text clipped - 57 lines]

Merle


--
Message posted via http://www.officekb.com



 
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
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
changing a cell from date to a number mwhite Excel Worksheet Functions 1 March 22nd 05 04:35 PM
i want to add a number to a date and get the date as an answer eg. traineeross Excel Worksheet Functions 2 March 9th 05 11:59 AM
unwanted number to date conversion while pasting data from web Jacek Excel Worksheet Functions 1 February 24th 05 02:59 PM
Use Julian Date To Create Serial Number antho10359 Excel Discussion (Misc queries) 4 December 9th 04 01:50 AM


All times are GMT +1. The time now is 10:30 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"