View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Differentiate between Number and Date?

If cell.Value Then

I don't know what you mean by cell.Value(c), that is invalid syntax

--

HTH

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


"Merle via OfficeKB.com" <u17293@uwe wrote in message
news:5a1ecdd1f2af2@uwe...
I've been able to do this successfully with the one exception of

determining
whether a cell is TRUE/FALSE (and therefore for my purpose a Logical

field).
In Help there's List of Worksheet Functions available to Visual Basic

which
lists IsLogical but I get this error:

Sub or Function not defined

...when I try to use it.

I've also tried using

cell.Value(c) = "TRUE"
cell.Value(c) = 1
cell.Text(c) = "TRUE"

...neither of which work either as it evidently doesn't recognize what's

in
that field as either one.

How does one test for a logical field?

Merle

Bob Phillips wrote:
That's because there is no date type in Excel, dates are just numbers

since
1st Jan 1900. You need a UDF, something like

Function CellType(rng As Range)
If rng.Count = 1 Then
If IsDate(rng) Then
CellType = "D"
ElseIf IsArray(rng) Then
CellType = "A"
ElseIf IsNumeric(rng) Then
CellType = "N"
ElseIf IsError(rng) Then
CellType = "E"
Else
CellType = "T"
End If
End If
End Function

I'm trying to determine the type of information in each column. I was

using
the TYPE function but it doesn't differentiate between a Number and a

Date.
[quoted text clipped - 13 lines]

Merle


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200601/1